Skip to content

Commit

Permalink
- Adjust for libogc2 changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Feb 13, 2025
1 parent eb2dec0 commit dc44d41
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
1 change: 0 additions & 1 deletion cube/swiss/include/patcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ typedef struct FuncPattern
} FuncPattern;

/* the SDGecko/IDE-EXI patches */
#include "stub_bin.h"
#include "sd_v1_bin.h"
#include "sd_v1_card_bin.h"
#include "sd_v1_dtk_bin.h"
Expand Down
20 changes: 19 additions & 1 deletion cube/swiss/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "httpd.h"
#include "config.h"
#include "sram.h"
#include "stub_bin.h"
#include "gui/FrameBufferMagic.h"
#include "gui/IPLFontWrite.h"
#include "devices/deviceHandler.h"
Expand All @@ -51,7 +52,7 @@ static void driveInfoCallback(s32 result, dvdcmdblk *block) {
}

/* Initialise Video, PAD, DVD, Font */
void Initialise (void)
void Initialise(void)
{
PAD_Init ();
DVD_Init();
Expand All @@ -68,6 +69,7 @@ void Initialise (void)
swissSettings.sramVideo = SYS_VIDEO_PAL;
else if(!strncmp(&IPLInfo[0x55], "MPAL", 4))
swissSettings.sramVideo = SYS_VIDEO_MPAL;
*(u32*)0x800000CC = swissSettings.sramVideo;

GXRModeObj *vmode = getVideoMode();
setVideoMode(vmode);
Expand All @@ -76,6 +78,22 @@ void Initialise (void)
DrawInit();
}

void __SYS_PreInit(void)
{
DCZeroRange((void *)0x80000000, 0x3100);

*(u32 *)0x80000028 = 0x01800000;
*(u32 *)0x800000F8 = TB_BUS_CLOCK;
*(u32 *)0x800000FC = TB_CORE_CLOCK;

memcpy((void *)0x80001800, stub_bin, stub_bin_size);
DCFlushRangeNoSync((void *)0x80001800, stub_bin_size);
ICInvalidateRange((void *)0x80001800, stub_bin_size);
_sync();

*(u64 *)0x800030D8 = -__builtin_ppc_get_timebase();
}

uiDrawObj_t *configProgBar = NULL;
void config_migration(char* text, int state, int percent) {
if(state) {
Expand Down
8 changes: 0 additions & 8 deletions cube/swiss/source/patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,6 @@ int install_code(int final)
return 1;
}

void __SYS_PreInit()
{
memcpy((void *)0x80001800, stub_bin, stub_bin_size);
DCFlushRangeNoSync((void *)0x80001800, stub_bin_size);
ICInvalidateRange((void *)0x80001800, stub_bin_size);
_sync();
}

void make_pattern(u32 *data, u32 offsetFoundAt, u32 length, FuncPattern *functionPattern)
{
u32 i, j;
Expand Down
4 changes: 3 additions & 1 deletion cube/swiss/source/swiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,14 +1022,16 @@ void load_app(ExecutableFile *fileToPatch)
print_gecko("Top of RAM simulated as: 0x%08X\r\n", topAddr);

*(vu32*)(VAR_AREA+0x0028) = 0x01800000;
*(vu32*)(VAR_AREA+0x002C) = (swissSettings.debugUSB ? 0x10000004:0x00000001) + (*(vu32*)0xCC00302C >> 28);
*(vu32*)(VAR_AREA+0x002C) = swissSettings.debugUSB ? 0x10000004:0x00000001;
*(vu32*)(VAR_AREA+0x002C) += *(vu32*)0xCC00302C >> 28;
*(vu32*)(VAR_AREA+0x00CC) = swissSettings.sramVideo;
*(vu32*)(VAR_AREA+0x00D0) = 0x01000000;
*(vu32*)(VAR_AREA+0x00E8) = 0x81800000 - topAddr;
*(vu32*)(VAR_AREA+0x00EC) = topAddr;
*(vu32*)(VAR_AREA+0x00F0) = 0x01800000;
*(vu32*)(VAR_AREA+0x00F8) = TB_BUS_CLOCK;
*(vu32*)(VAR_AREA+0x00FC) = TB_CORE_CLOCK;
*(vu64*)(VAR_AREA+0x30D8) = -gettime();

// Copy the game header to 0x80000000
memcpy(VAR_AREA,(void*)&GCMDisk,0x20);
Expand Down

0 comments on commit dc44d41

Please sign in to comment.