Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ echo.
echo Building DS ROMs
echo.
make clean
make Windows_NT=1
make Windows_NT=1 CB=1

cd ../installer
echo.
Expand Down
20 changes: 0 additions & 20 deletions Build_CBHC.bat

This file was deleted.

5 changes: 0 additions & 5 deletions dsrom/CBHC/arm_kernel/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ int _main()
}

// change system.xml to syshax.xml
*(volatile u32*)(0x050600F0 - 0x05060000 + 0x08220000) = 0x79736861; //ysha
*(volatile u32*)(0x050600F4 - 0x05060000 + 0x08220000) = 0x782E786D; //x.xm

*(volatile u32*)(0x05060114 - 0x05060000 + 0x08220000) = 0x79736861; //ysha
*(volatile u32*)(0x05060118 - 0x05060000 + 0x08220000) = 0x782E786D; //x.xm

*(volatile u32*)(0x1555500) = 0;

Expand Down
5 changes: 0 additions & 5 deletions dsrom/CBHC/arm_kernel/source/reload.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ void kernel_launch_ios(u32 launch_address, u32 L, u32 C, u32 H)
section_write_word(ios_elf_start, 0x05054D70, 0xE12FFF1E); // bx lr

// change system.xml to syshax.xml
section_write_word(ios_elf_start, 0x050600F0, 0x79736861); //ysha
section_write_word(ios_elf_start, 0x050600F4, 0x782E786D); //x.xm

section_write_word(ios_elf_start, 0x05060114, 0x79736861); //ysha
section_write_word(ios_elf_start, 0x05060118, 0x782E786D); //x.xm

// overwrite mcp_d_r code with wupserver
section_write_word(ios_elf_start, 0x0510E56C, 0x47700000); //bx lr
Expand Down
193 changes: 6 additions & 187 deletions dsrom/CBHC/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,26 +98,6 @@ uint32_t __main(void)
OSDynLoad_FindExport(vpad_handle, 0, "VPADRead", &VPADRead);

int vpadError = -1;
VPADData vpad;
VPADRead(0, &vpad, 1, &vpadError);
if(vpadError == 0)
{
if(((vpad.btns_d|vpad.btns_h) & FORCE_SYSMENU) == FORCE_SYSMENU)
{
// iosuhax-less menu launch backup code
int(*_SYSLaunchTitleWithStdArgsInNoSplash)(unsigned long long tid, void *ptr);
OSDynLoad_FindExport(sysapp_handle,0,"_SYSLaunchTitleWithStdArgsInNoSplash",&_SYSLaunchTitleWithStdArgsInNoSplash);
_SYSLaunchTitleWithStdArgsInNoSplash(sysmenu, 0);
OSExitThread(0);
return 0;
}
else if(((vpad.btns_d|vpad.btns_h) & FORCE_HBL) == FORCE_HBL)
{
// original hbl loader payload
strcpy((void*)0xF5E70000,SD_HBL_PATH);
return 0x01800000;
}
}

unsigned int *pMEMAllocFromDefaultHeapEx;
unsigned int *pMEMFreeToDefaultHeap;
Expand Down Expand Up @@ -182,26 +162,7 @@ uint32_t __main(void)
FSAddClient(pClient, -1);
FSInitCmdBlock(pCmd);

int autoboot = -1;
int iFd = -1;
int i;
for(i = 0; i < DEFAULT_MAX; i++)
{
SAVEOpenFile(pClient, pCmd, slot, defOpts[i], "r", &iFd, -1);
if (iFd >= 0)
{
autoboot = i;
FSCloseFile(pClient, pCmd, iFd, -1);
break;
}
}
if(autoboot < 0)
{
autoboot = DEFAULT_DISABLED;
SAVEOpenFile(pClient, pCmd, slot, defOpts[DEFAULT_DISABLED], "w", &iFd, -1);
if (iFd >= 0)
FSCloseFile(pClient, pCmd, iFd, -1);
}
int autoboot = 1;
int launchmode = (autoboot > 0) ? (autoboot - 1) : LAUNCH_SYSMENU;
int cur_autoboot = autoboot;

Expand Down Expand Up @@ -261,140 +222,17 @@ uint32_t __main(void)
WPADSetSpeakerVolume(1);
WPADSetSyncDeviceCallback(WPADSetSpeakerVolume);

if(autoboot == DEFAULT_DISABLED)
goto cbhc_menu;

OSScreenClearBuffer(0);
OSScreenPutFont(0, 0, verChar);
OSScreenPutFont(0, 1, "Autobooting...");
OSScreenFlipBuffers();

//garbage read
getButtonsDown(padscore_handle, vpad_handle);
//see if menu is requested
int loadMenu = 0;
int waitCnt = 40;
while(waitCnt--)
{
unsigned int btnDown = getButtonsDown(padscore_handle, vpad_handle);

if((btnDown & VPAD_BUTTON_HOME) || WPADGetSpeakerVolume() == 0)
{
WPADSetSpeakerVolume(1);
loadMenu = 1;
break;
}
usleep(50000);
}
int waitCnt = 0;

if(loadMenu == 0)
goto doIOSUexploit;
goto doIOSUexploit;

OSScreenClearBuffer(0);
OSScreenPutFont(0, 0, verChar);
OSScreenPutFont(0, 1, "Entering Menu...");
OSScreenFlipBuffers();
waitCnt = 30;
while(waitCnt--)
{
getButtonsDown(padscore_handle, vpad_handle);
usleep(50000);
}

cbhc_menu: ;
int redraw = 1;
int PosX = 0;
int ListMax = 5;
int clickT = 0;
while(1)
{
unsigned int btnDown = getButtonsDown(padscore_handle, vpad_handle);

if(WPADGetSpeakerVolume() == 0)
{
if(clickT == 0)
clickT = 8;
else
{
btnDown |= VPAD_BUTTON_A;
clickT = 0;
}
WPADSetSpeakerVolume(1);
}
else if(clickT)
{
clickT--;
if(clickT == 0)
btnDown |= VPAD_BUTTON_DOWN;
}

if( btnDown & VPAD_BUTTON_DOWN )
{
if(PosX+1 == ListMax)
PosX = 0;
else
PosX++;
redraw = 1;
}

if( btnDown & VPAD_BUTTON_UP )
{
if( PosX <= 0 )
PosX = (ListMax-1);
else
PosX--;
redraw = 1;
}

if( btnDown & VPAD_BUTTON_A )
{
if(PosX == 4)
{
cur_autoboot++;
if(cur_autoboot == DEFAULT_MAX)
cur_autoboot = DEFAULT_DISABLED;
redraw = 1;
}
else
{
launchmode = PosX;
break;
}
}

if(redraw)
{
OSScreenClearBuffer(0);
OSScreenPutFont(0, 0, verChar);

char printStr[64];
__os_snprintf(printStr,64,"%c Boot System Menu", 0 == PosX ? '>' : ' ');
OSScreenPutFont(0, 1, printStr);
__os_snprintf(printStr,64,"%c Boot Homebrew Launcher", 1 == PosX ? '>' : ' ');
OSScreenPutFont(0, 2, printStr);
__os_snprintf(printStr,64,"%c Boot Mocha CFW", 2 == PosX ? '>' : ' ');
OSScreenPutFont(0, 3, printStr);
__os_snprintf(printStr,64,"%c Boot fw.img on SD Card", 3 == PosX ? '>' : ' ');
OSScreenPutFont(0, 4, printStr);
__os_snprintf(printStr,64,"%c Autoboot: %s", 4 == PosX ? '>' : ' ', bootOpts[cur_autoboot]);
OSScreenPutFont(0, 5, printStr);

OSScreenFlipBuffers();
redraw = 0;
}
usleep(50000);
}
OSScreenClearBuffer(0);
OSScreenFlipBuffers();
usleep(50000);

doIOSUexploit:
WPADSetSpeakerVolume(oriVol);
KPADShutdown();

if(cur_autoboot != autoboot)
SAVERename(pClient, pCmd, slot, defOpts[autoboot], defOpts[cur_autoboot], -1);

SAVEFlushQuota(pClient, pCmd, slot, -1);
FSDelClient(pClient);
SAVEShutdown();
Expand Down Expand Up @@ -437,29 +275,10 @@ cbhc_menu: ;

IOS_Close(dev_uhs_0_handle);

if(launchmode == LAUNCH_HBL)
{
strcpy((void*)0xF5E70000,SD_HBL_PATH);
return 0x01800000;
}
else if(launchmode == LAUNCH_MOCHA)
{
strcpy((void*)0xF5E70000,SD_MOCHA_PATH);
return 0x01800000;
}
//sysmenu or cfw
if(launchmode == LAUNCH_CFW_IMG)
{
OSForceFullRelaunch();
if(defaultSlot) //normal menu boot
SYSLaunchMenu();
}
else
{
if(defaultSlot) //normal menu boot
SYSLaunchMenu();
else //show mii select
_SYSLaunchMenuWithCheckingAccount(slot);
}
else //show mii select
_SYSLaunchMenuWithCheckingAccount(slot);
OSExitThread(0);
return 0;
}
Expand Down
26 changes: 0 additions & 26 deletions installer/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,32 +518,6 @@ int Menu_Main(void)
#endif
char sdPath[256];

#ifndef CB
sprintf(sdPath,"%s/config.txt",sdHaxchiPath);
if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0)
{
//read in sd file
fileStat_s stats;
IOSUHAX_FSA_StatFile(fsaFd, sdFd, &stats);
size_t cfgSize = stats.size;
uint8_t *cfgBuf = malloc(cfgSize);
fsa_read(fsaFd, sdFd, cfgBuf, cfgSize);
IOSUHAX_FSA_CloseFile(fsaFd, sdFd);
sdFd = -1;
//write to nand
sprintf(path,"%s/content/config.txt",SelectedGame->path);
if(IOSUHAX_FSA_OpenFile(fsaFd, path, "wb", &mlcFd) >= 0)
{
println(line++,"Writing config.txt...");
fsa_write(fsaFd, mlcFd, cfgBuf, cfgSize);
IOSUHAX_FSA_CloseFile(fsaFd, mlcFd);
mlcFd = -1;
//make it readable by game
IOSUHAX_FSA_ChangeMode(fsaFd, path, 0x644);
}
free(cfgBuf);
}
#endif

sprintf(sdPath,"%s/title.txt",sdHaxchiPath);
if(IOSUHAX_FSA_OpenFile(fsaFd, sdPath, "rb", &sdFd) >= 0)
Expand Down