mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-11-22 12:59:14 +01:00
Implemented VI register tracking
This commit is contained in:
parent
e90f9974ba
commit
f024c4db84
@ -193,8 +193,8 @@ int sdl_event_filter(void* userdata, SDL_Event* event) {
|
|||||||
|
|
||||||
button = new_button;
|
button = new_button;
|
||||||
|
|
||||||
stick_x = 127 * (key_states[SDL_Scancode::SDL_SCANCODE_D] - key_states[SDL_Scancode::SDL_SCANCODE_A]);
|
stick_x = 85 * (key_states[SDL_Scancode::SDL_SCANCODE_D] - key_states[SDL_Scancode::SDL_SCANCODE_A]);
|
||||||
stick_y = 127 * (key_states[SDL_Scancode::SDL_SCANCODE_W] - key_states[SDL_Scancode::SDL_SCANCODE_S]);
|
stick_y = 85 * (key_states[SDL_Scancode::SDL_SCANCODE_W] - key_states[SDL_Scancode::SDL_SCANCODE_S]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_EventType::SDL_QUIT:
|
case SDL_EventType::SDL_QUIT:
|
||||||
@ -304,9 +304,46 @@ void event_thread_func(uint8_t* rdram, uint8_t* rom, std::atomic_flag* events_th
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned int VI_STATUS_REG;
|
||||||
|
extern unsigned int VI_ORIGIN_REG;
|
||||||
|
extern unsigned int VI_WIDTH_REG;
|
||||||
|
extern unsigned int VI_INTR_REG;
|
||||||
|
extern unsigned int VI_V_CURRENT_LINE_REG;
|
||||||
|
extern unsigned int VI_TIMING_REG;
|
||||||
|
extern unsigned int VI_V_SYNC_REG;
|
||||||
|
extern unsigned int VI_H_SYNC_REG;
|
||||||
|
extern unsigned int VI_LEAP_REG;
|
||||||
|
extern unsigned int VI_H_START_REG;
|
||||||
|
extern unsigned int VI_V_START_REG;
|
||||||
|
extern unsigned int VI_V_BURST_REG;
|
||||||
|
extern unsigned int VI_X_SCALE_REG;
|
||||||
|
extern unsigned int VI_Y_SCALE_REG;
|
||||||
|
|
||||||
|
uint32_t vi_origin_offset = 320 * sizeof(uint16_t);
|
||||||
|
|
||||||
extern "C" void osViSwapBuffer(RDRAM_ARG PTR(void) frameBufPtr) {
|
extern "C" void osViSwapBuffer(RDRAM_ARG PTR(void) frameBufPtr) {
|
||||||
events_context.vi.next_buffer = frameBufPtr;
|
events_context.vi.next_buffer = frameBufPtr;
|
||||||
events_context.action_queue.enqueue(SwapBuffersAction{ osVirtualToPhysical(frameBufPtr) + 640 });
|
events_context.action_queue.enqueue(SwapBuffersAction{ osVirtualToPhysical(frameBufPtr) + vi_origin_offset });
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void osViSetMode(RDRAM_ARG PTR(OSViMode) mode_) {
|
||||||
|
OSViMode* mode = TO_PTR(OSViMode, mode_);
|
||||||
|
VI_STATUS_REG = mode->comRegs.ctrl;
|
||||||
|
VI_WIDTH_REG = mode->comRegs.width;
|
||||||
|
// burst
|
||||||
|
VI_V_SYNC_REG = mode->comRegs.vSync;
|
||||||
|
VI_H_SYNC_REG = mode->comRegs.hSync;
|
||||||
|
VI_LEAP_REG = mode->comRegs.leap;
|
||||||
|
VI_H_START_REG = mode->comRegs.hStart;
|
||||||
|
VI_X_SCALE_REG = mode->comRegs.xScale;
|
||||||
|
VI_V_CURRENT_LINE_REG = mode->comRegs.vCurrent;
|
||||||
|
|
||||||
|
// TODO swap these every VI to account for fields changing
|
||||||
|
vi_origin_offset = mode->fldRegs[0].origin;
|
||||||
|
VI_Y_SCALE_REG = mode->fldRegs[0].yScale;
|
||||||
|
VI_V_START_REG = mode->fldRegs[0].vStart;
|
||||||
|
VI_V_BURST_REG = mode->fldRegs[0].vBurst;
|
||||||
|
VI_INTR_REG = mode->fldRegs[0].vIntr;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" PTR(void) osViGetNextFramebuffer() {
|
extern "C" PTR(void) osViGetNextFramebuffer() {
|
||||||
|
@ -176,6 +176,33 @@ struct OSPiHandle {
|
|||||||
u32 transferInfo[18]; /* for disk only */
|
u32 transferInfo[18]; /* for disk only */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u32 ctrl;
|
||||||
|
u32 width;
|
||||||
|
u32 burst;
|
||||||
|
u32 vSync;
|
||||||
|
u32 hSync;
|
||||||
|
u32 leap;
|
||||||
|
u32 hStart;
|
||||||
|
u32 xScale;
|
||||||
|
u32 vCurrent;
|
||||||
|
} OSViCommonRegs;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u32 origin;
|
||||||
|
u32 yScale;
|
||||||
|
u32 vStart;
|
||||||
|
u32 vBurst;
|
||||||
|
u32 vIntr;
|
||||||
|
} OSViFieldRegs;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u8 padding[3];
|
||||||
|
u8 type;
|
||||||
|
OSViCommonRegs comRegs;
|
||||||
|
OSViFieldRegs fldRegs[2];
|
||||||
|
} OSViMode;
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// Functions //
|
// Functions //
|
||||||
///////////////
|
///////////////
|
||||||
@ -207,6 +234,7 @@ s32 osRecvMesg(RDRAM_ARG PTR(OSMesgQueue), PTR(OSMesg), s32);
|
|||||||
void osSetEventMesg(RDRAM_ARG OSEvent, PTR(OSMesgQueue), OSMesg);
|
void osSetEventMesg(RDRAM_ARG OSEvent, PTR(OSMesgQueue), OSMesg);
|
||||||
void osViSetEvent(RDRAM_ARG PTR(OSMesgQueue), OSMesg, u32);
|
void osViSetEvent(RDRAM_ARG PTR(OSMesgQueue), OSMesg, u32);
|
||||||
void osViSwapBuffer(RDRAM_ARG PTR(void) frameBufPtr);
|
void osViSwapBuffer(RDRAM_ARG PTR(void) frameBufPtr);
|
||||||
|
void osViSetMode(RDRAM_ARG PTR(OSViMode));
|
||||||
PTR(void) osViGetNextFramebuffer();
|
PTR(void) osViGetNextFramebuffer();
|
||||||
PTR(void) osViGetCurrentFramebuffer();
|
PTR(void) osViGetCurrentFramebuffer();
|
||||||
u32 osGetCount();
|
u32 osGetCount();
|
||||||
|
@ -34,5 +34,5 @@ extern "C" void osViSwapBuffer_recomp(uint8_t* rdram, recomp_context* ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void osViSetMode_recomp(uint8_t* rdram, recomp_context* ctx) {
|
extern "C" void osViSetMode_recomp(uint8_t* rdram, recomp_context* ctx) {
|
||||||
;
|
osViSetMode(rdram, (int32_t)ctx->r4);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user