Fix string handling bugs
This commit is contained in:
parent
ee880802c8
commit
9f12a47cfc
@ -32,7 +32,7 @@ void main(int argc __attribute__((unused)), char **argv)
|
||||
u32 i;
|
||||
for(i = 0; i < 91 && argv[1] != 0; i++)
|
||||
absPath[i] = argv[1][i];
|
||||
for(; i < 91; i++)
|
||||
for(; i < 92; i++)
|
||||
absPath[i] = 0;
|
||||
|
||||
char *argvPassed[1] = {absPath};
|
||||
|
@ -105,8 +105,11 @@ arm11_entrypoint_addr equ 0x1FFFFFFC
|
||||
bytes_read: .word 0
|
||||
fopen: .ascii "OPEN"
|
||||
.pool
|
||||
fname: .dcw "sdmc:/arm9loaderha.firm"
|
||||
.word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
.area 82, 0
|
||||
fname: .dcw "sdmc:/boot.firm"
|
||||
.endarea
|
||||
|
||||
.pool
|
||||
nand_mount: .dcw "nand"
|
||||
|
||||
|
@ -33,13 +33,14 @@
|
||||
#include "crypto.h"
|
||||
#include "fmt.h"
|
||||
#include "memory.h"
|
||||
#include "i2c.h"
|
||||
|
||||
extern CfgData configData;
|
||||
extern ConfigurationStatus needConfig;
|
||||
extern FirmwareSource firmSource;
|
||||
|
||||
u16 launchedFirmTidLow[8];
|
||||
u16 launchedPath[42];
|
||||
u16 launchedPath[41];
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
@ -58,7 +59,7 @@ void main(int argc, char **argv)
|
||||
case 1: //Normal boot
|
||||
{
|
||||
u32 i;
|
||||
for(i = 0; i < 41 && launchedPath[i] != 0; i++) //Copy and convert the path to utf16
|
||||
for(i = 0; i < 40 && launchedPath[i] != 0; i++) //Copy and convert the path to utf16
|
||||
launchedPath[2 * i] = argv[0][i];
|
||||
for(; i < 41; i++)
|
||||
launchedPath[i] = 0;
|
||||
@ -70,9 +71,12 @@ void main(int argc, char **argv)
|
||||
|
||||
case 2: //Firmlaunch
|
||||
{
|
||||
|
||||
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 0);
|
||||
while(true);
|
||||
u32 i;
|
||||
u16 *p = (u16 *)argv[0];
|
||||
for(i = 0; i < 41 && launchedPath[i] != 0; i++)
|
||||
for(i = 0; i < 40 && launchedPath[i] != 0; i++)
|
||||
launchedPath[i] = p[i];
|
||||
for(; i < 41; i++)
|
||||
launchedPath[i] = 0;
|
||||
|
@ -135,8 +135,8 @@ u32 patchFirmlaunches(u8 *pos, u32 size, u32 process9MemAddr)
|
||||
u32 *pos_fopen = (u32 *)memsearch(off, "OPEN", reboot_bin_size, 4);
|
||||
*pos_fopen = fOpenOffset;
|
||||
|
||||
//u16 *fname = (u16 *)memsearch(off, u"sd", reboot_bin_size, 4);
|
||||
//memcpy(fname, u"sdmc:/test.firm", 32);
|
||||
u16 *fname = (u16 *)memsearch(off, u"sd", reboot_bin_size, 4);
|
||||
memcpy(fname, launchedPath, 82);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,4 +116,4 @@ typedef enum FirmwareType
|
||||
} FirmwareType;
|
||||
|
||||
extern u16 launchedFirmTidLow[8];
|
||||
extern u16 launchedPath[42];
|
||||
extern u16 launchedPath[41];
|
||||
|
Reference in New Issue
Block a user