-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Liu Woon Yung <[email protected]>
- Loading branch information
Showing
5 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# Copyright 2001-2024, ps2dev - http://www.ps2dev.org | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
|
||
EE_OBJS = hddboot.o erl_support.o | ||
|
||
include $(PS2SDKSRC)/Defs.make | ||
include $(PS2SDKSRC)/ee/Rules.lib.make | ||
include $(PS2SDKSRC)/ee/Rules.make | ||
include $(PS2SDKSRC)/ee/Rules.release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef H_HDDBOOT_INC | ||
#define H_HDDBOOT_INC | ||
|
||
void CheckHDDUpdate(int device, const char *SysExecFolder); | ||
int GetHddSupportEnabledStatus(void); | ||
int GetHddUpdateStatus(void); | ||
void DetermineHDDLoadStatus(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
# _____ ___ ____ ___ ____ | ||
# ____| | ____| | | |____| | ||
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. | ||
#----------------------------------------------------------------------- | ||
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org | ||
# Licenced under Academic Free License version 2.0 | ||
# Review ps2sdk README & LICENSE files for further details. | ||
# | ||
# The erl-tags support | ||
*/ | ||
|
||
#include <erl.h> | ||
|
||
char * erl_id = "libhddboot"; | ||
char * erl_dependancies[] = { | ||
"libkernel", | ||
"libc", | ||
0 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <kernel.h> | ||
#include <loadfile.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <errno.h> | ||
|
||
#include "HDDSupport.h" | ||
|
||
static volatile unsigned int HDDLoadStatArea[4] ALIGNED(16); | ||
static unsigned char IsHddSupportEnabled=0, HddSupportStatus=0; | ||
|
||
void CheckHDDUpdate(int device, const char *SysExecFolder){ | ||
char CmdStr[34], ModulePath[40]; | ||
|
||
sprintf(ModulePath, "mc%u:/%s/dev9.irx", device, SysExecFolder); | ||
if(SifLoadModule(ModulePath, 0, NULL)>=0){ | ||
sprintf(ModulePath, "mc%u:/%s/atad.irx", device, SysExecFolder); | ||
if(SifLoadModule(ModulePath, 0, NULL)>=0){ | ||
strcpy(CmdStr, "-osd"); | ||
strcpy(&CmdStr[5], "0x00100000"); | ||
strcpy(&CmdStr[16], "-stat"); | ||
sprintf(&CmdStr[22], "%p", HDDLoadStatArea); | ||
CmdStr[sizeof(CmdStr)-1]='\0'; | ||
|
||
sprintf(ModulePath, "mc%u:/%s/hddload.irx", device, SysExecFolder); | ||
if(SifLoadModule(ModulePath, sizeof(CmdStr), CmdStr)>=0){ | ||
IsHddSupportEnabled = 1; | ||
} | ||
} | ||
} | ||
} | ||
|
||
int GetHddSupportEnabledStatus(void){ | ||
return IsHddSupportEnabled; | ||
} | ||
|
||
int GetHddUpdateStatus(void){ | ||
return HddSupportStatus; | ||
} | ||
|
||
void DetermineHDDLoadStatus(void){ | ||
int result; | ||
|
||
if((result=*(int *)UNCACHED_SEG(HDDLoadStatArea))==1){ | ||
HddSupportStatus = 1; | ||
} | ||
else if(result<0){ | ||
IsHddSupportEnabled = 0; | ||
} | ||
} |