mirror of
https://github.com/Maschell/hid_to_vpad.git
synced 2024-11-09 17:05:05 +01:00
Small fixes
This commit is contained in:
parent
92ec4b680a
commit
2d1e2f42d0
18
src/main.c
18
src/main.c
@ -16,20 +16,11 @@
|
|||||||
#include "game/memory_area_table.h"
|
#include "game/memory_area_table.h"
|
||||||
#include "start.h"
|
#include "start.h"
|
||||||
#include "patcher/function_hooks.h"
|
#include "patcher/function_hooks.h"
|
||||||
|
#include "patcher/cpp_to_c_util.h"
|
||||||
#include "kernel/kernel_functions.h"
|
#include "kernel/kernel_functions.h"
|
||||||
#include "system/exception_handler.h"
|
#include "system/exception_handler.h"
|
||||||
#include "fs/fs_utils.h"
|
|
||||||
#include "fs/sd_fat_devoptab.h"
|
|
||||||
#include "controller_patcher/controller_patcher.h"
|
#include "controller_patcher/controller_patcher.h"
|
||||||
|
|
||||||
typedef union u_serv_ip
|
|
||||||
{
|
|
||||||
uint8_t digit[4];
|
|
||||||
uint32_t full;
|
|
||||||
} u_serv_ip;
|
|
||||||
|
|
||||||
#define PRINT_TEXT2(x, y, ...) { snprintf(msg, 80, __VA_ARGS__); OSScreenPutFontEx(0, x, y, msg); OSScreenPutFontEx(1, x, y, msg); }
|
|
||||||
|
|
||||||
/* Entry point */
|
/* Entry point */
|
||||||
int Menu_Main(void)
|
int Menu_Main(void)
|
||||||
{
|
{
|
||||||
@ -42,6 +33,8 @@ int Menu_Main(void)
|
|||||||
InitGX2FunctionPointers();
|
InitGX2FunctionPointers();
|
||||||
InitSysFunctionPointers();
|
InitSysFunctionPointers();
|
||||||
|
|
||||||
|
draw_Cursor_destroy();
|
||||||
|
|
||||||
log_init("192.168.0.181");
|
log_init("192.168.0.181");
|
||||||
|
|
||||||
SetupKernelCallback();
|
SetupKernelCallback();
|
||||||
@ -59,11 +52,12 @@ int Menu_Main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(strlen(cosAppXmlInfoStruct.rpx_name) <= 0){ // First boot back to SysMenu
|
if(strlen(cosAppXmlInfoStruct.rpx_name) <= 0){ // First boot back to SysMenu
|
||||||
log_printf("Startssed %s\n", cosAppXmlInfoStruct.rpx_name);
|
|
||||||
SYSLaunchMenu();
|
SYSLaunchMenu();
|
||||||
return EXIT_RELAUNCH_ON_LOAD;
|
return EXIT_RELAUNCH_ON_LOAD;
|
||||||
}
|
}
|
||||||
log_printf("Stafdsf %s\n", cosAppXmlInfoStruct.rpx_name);
|
|
||||||
|
draw_Cursor_destroy();
|
||||||
|
|
||||||
RestoreInstructions();
|
RestoreInstructions();
|
||||||
|
|
||||||
deinit_config_controller();
|
deinit_config_controller();
|
||||||
|
@ -3,8 +3,26 @@
|
|||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "video/shaders/ColorShader.h"
|
#include "video/shaders/ColorShader.h"
|
||||||
|
|
||||||
// TODO: not creating these stuff at every frame
|
u8 gCursorInitDone __attribute__((section(".data"))) = 0;
|
||||||
|
|
||||||
|
static u8 * cursor_colorVtxs = NULL;
|
||||||
|
|
||||||
|
void init_cursor(){
|
||||||
|
if(!gCursorInitDone){
|
||||||
|
if(!cursor_colorVtxs){
|
||||||
|
cursor_colorVtxs = (u8*)memalign(0x40, sizeof(u8) * 16);
|
||||||
|
if(cursor_colorVtxs == NULL) return;
|
||||||
|
}
|
||||||
|
memset(cursor_colorVtxs,0xFF,16*sizeof(u8));
|
||||||
|
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, cursor_colorVtxs, 16 * sizeof(u8));
|
||||||
|
gCursorInitDone = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void draw_Cursor_at(f32 x, f32 y) {
|
void draw_Cursor_at(f32 x, f32 y) {
|
||||||
|
init_cursor();
|
||||||
|
if(cursor_colorVtxs == NULL) return;
|
||||||
|
|
||||||
f32 widthScaleFactor = 1.0f / (f32)1280;
|
f32 widthScaleFactor = 1.0f / (f32)1280;
|
||||||
f32 heightScaleFactor = 1.0f / (f32)720;
|
f32 heightScaleFactor = 1.0f / (f32)720;
|
||||||
|
|
||||||
@ -15,31 +33,27 @@ void draw_Cursor_at(f32 x, f32 y) {
|
|||||||
positionOffsets[0] = (x-((1280)/2)+(width/2)) * widthScaleFactor * 2.0f;
|
positionOffsets[0] = (x-((1280)/2)+(width/2)) * widthScaleFactor * 2.0f;
|
||||||
positionOffsets[1] = -(y-((720)/2)+(width/2)) * heightScaleFactor * 2.0f;
|
positionOffsets[1] = -(y-((720)/2)+(width/2)) * heightScaleFactor * 2.0f;
|
||||||
|
|
||||||
u8 colorVtxs[16];
|
|
||||||
memset(colorVtxs,0xFF,16*sizeof(u8));
|
|
||||||
|
|
||||||
GX2Invalidate(GX2_INVALIDATE_CPU_ATTRIB_BUFFER, colorVtxs, 16 * sizeof(u8));
|
|
||||||
|
|
||||||
glm::vec4 colorIntensity = glm::vec4(1.0f);
|
|
||||||
colorIntensity[3] = 255;
|
|
||||||
|
|
||||||
glm::vec3 scale(width*widthScaleFactor,width*heightScaleFactor,1.0f);
|
glm::vec3 scale(width*widthScaleFactor,width*heightScaleFactor,1.0f);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ColorShader::instance()->setShaders();
|
ColorShader::instance()->setShaders();
|
||||||
ColorShader::instance()->setAttributeBuffer(colorVtxs, NULL, 4);
|
ColorShader::instance()->setAttributeBuffer(cursor_colorVtxs, NULL, 4);
|
||||||
ColorShader::instance()->setAngle(0);
|
ColorShader::instance()->setAngle(0);
|
||||||
ColorShader::instance()->setOffset(positionOffsets);
|
ColorShader::instance()->setOffset(positionOffsets);
|
||||||
ColorShader::instance()->setScale(scale);
|
ColorShader::instance()->setScale(scale);
|
||||||
ColorShader::instance()->setColorIntensity(colorIntensity);
|
ColorShader::instance()->setColorIntensity(glm::vec4(1.0f));
|
||||||
ColorShader::instance()->draw(GX2_PRIMITIVE_QUADS, 4);
|
ColorShader::instance()->draw(GX2_PRIMITIVE_QUADS, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void draw_Cursor_destroy() {
|
void draw_Cursor_destroy() {
|
||||||
//! destroy shaders
|
//! destroy shaders
|
||||||
ColorShader::destroyInstance();
|
ColorShader::destroyInstance();
|
||||||
|
if(cursor_colorVtxs){
|
||||||
|
free(cursor_colorVtxs);
|
||||||
|
cursor_colorVtxs = NULL;
|
||||||
|
}
|
||||||
|
gCursorInitDone = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user