|
5 | 5 | #include <stdio.h> |
6 | 6 | #include <errno.h> |
7 | 7 |
|
8 | | -#include "HDDSupport.h" |
| 8 | +#include "hdd_boot.h" |
9 | 9 |
|
10 | 10 | static volatile unsigned int HDDLoadStatArea[4] ALIGNED(16); |
11 | 11 | static unsigned char IsHddSupportEnabled=0, HddSupportStatus=0; |
| 12 | +char CmdStr[34]; |
| 13 | + |
| 14 | +static void construct_params() { |
| 15 | + memset(&CmdStr, 0, sizeof(CmdStr)); |
| 16 | + strcpy(CmdStr, "-osd"); |
| 17 | + strcpy(&CmdStr[5], "0x00100000"); |
| 18 | + strcpy(&CmdStr[16], "-stat"); |
| 19 | + sprintf(&CmdStr[22], "%p", HDDLoadStatArea); |
| 20 | + CmdStr[sizeof(CmdStr)-1]='\0'; |
| 21 | +} |
12 | 22 |
|
13 | | -void CheckHDDUpdate(int device, const char *SysExecFolder){ |
14 | | - char CmdStr[34], ModulePath[40]; |
15 | | - |
16 | | - sprintf(ModulePath, "mc%u:/%s/dev9.irx", device, SysExecFolder); |
17 | | - if(SifLoadModule(ModulePath, 0, NULL)>=0){ |
18 | | - sprintf(ModulePath, "mc%u:/%s/atad.irx", device, SysExecFolder); |
19 | | - if(SifLoadModule(ModulePath, 0, NULL)>=0){ |
20 | | - strcpy(CmdStr, "-osd"); |
21 | | - strcpy(&CmdStr[5], "0x00100000"); |
22 | | - strcpy(&CmdStr[16], "-stat"); |
23 | | - sprintf(&CmdStr[22], "%p", HDDLoadStatArea); |
24 | | - CmdStr[sizeof(CmdStr)-1]='\0'; |
25 | | - |
26 | | - sprintf(ModulePath, "mc%u:/%s/hddload.irx", device, SysExecFolder); |
27 | | - if(SifLoadModule(ModulePath, sizeof(CmdStr), CmdStr)>=0){ |
28 | | - IsHddSupportEnabled = 1; |
29 | | - } |
30 | | - } |
31 | | - } |
| 23 | +int BootHDDLoadBuffer(void* irx, unsigned int size, int* ret){ |
| 24 | + int id, rett; |
| 25 | + construct_params(); |
| 26 | + id = SifExecModuleBuffer(irx, size, sizeof(CmdStr), CmdStr, rett); |
| 27 | + if (id > 0 && rett != 1) IsHddSupportEnabled = 1; |
| 28 | + if (ret != NULL) *ret = rett; |
| 29 | + return id; |
| 30 | +} |
| 31 | + |
| 32 | +int BootHDDLoadFile(char* path, int* ret){ |
| 33 | + int id, rett; |
| 34 | + construct_params(); |
| 35 | + id = SifLoadStartModule(path, sizeof(CmdStr), CmdStr, rett); |
| 36 | + if (id > 0 && rett != 1) IsHddSupportEnabled = 1; |
| 37 | + if (ret != NULL) *ret = rett; |
| 38 | + return id; |
32 | 39 | } |
33 | 40 |
|
34 | 41 | int GetHddSupportEnabledStatus(void){ |
|
0 commit comments