Move Unlock Command.

* Moved SPI unlock command to save init function. Now this is only
called if user uses B button to do save erase in the save restore menu.
* File Not found stats box in file browser now matches color scheme. (no
longer using red color)
This commit is contained in:
ApacheThunder 2024-10-01 19:05:37 -05:00
parent f8a16adcdf
commit df31126acd
6 changed files with 14 additions and 14 deletions

View File

@ -9,7 +9,7 @@ export TARGET := EZP_Recovery_Tool
export TOPDIR := $(CURDIR) export TOPDIR := $(CURDIR)
# export VERSION_MAJOR := 1 # export VERSION_MAJOR := 1
# export VERSION_MINOR := 1 # export VERSION_MINOR := 2
# export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR) # export VERSTRING := $(VERSION_MAJOR).$(VERSION_MINOR)
# GMAE_ICON is the image used to create the game icon, leave blank to use default rule # GMAE_ICON is the image used to create the game icon, leave blank to use default rule

View File

@ -111,7 +111,7 @@ int cardmeGetType(void) {
u8 c00; u8 c00;
u8 c05; u8 c05;
u8 c9f; u8 c9f;
u8 reg; // u8 reg;
REG_EXMEMCNT &= ~0x0880; // DS Card access ARM9:bit11=0 GBA Cart access ARM9:bit7=0 REG_EXMEMCNT &= ~0x0880; // DS Card access ARM9:bit11=0 GBA Cart access ARM9:bit7=0
cardmeCMD(0x03,0); cardmeCMD(0x03,0);
@ -129,13 +129,6 @@ int cardmeGetType(void) {
fclose(testFile); fclose(testFile);
}*/ }*/
// Unlock block 0 (0x0 to 0x8000). Seems to only be possible if WP# is lifted though! // Courtasy of Nat (nathaantfm)
spiTransfer(0, 0, 1, 0x6); // Send write enable
spiTransfer(0, 0, 2, 0x1, 0x0); // Write status register bits 7-0
do {
spiTransfer(1, &reg, 1, 0x5); // Read status register
} while (reg & 0x1); // Write in progress
/*FILE *testFile2 = fopen("/registerData.bin", "wb"); /*FILE *testFile2 = fopen("/registerData.bin", "wb");
if (testFile2) { if (testFile2) {
u8 securityReg1[1]; u8 securityReg1[1];

View File

@ -17,6 +17,8 @@
extern "C" { extern "C" {
#endif #endif
void spiTransfer(int rlen, u8 *dst, int cmdlen, ...);
void cardmeReadEeprom(u32 address, u8 *data, u32 length, u32 addrtype); void cardmeReadEeprom(u32 address, u8 *data, u32 length, u32 addrtype);
void cardmeSectorErase(u32 address); void cardmeSectorErase(u32 address);
// int cardmeChipErase_old(void); // int cardmeChipErase_old(void);

View File

@ -180,12 +180,17 @@ int Save_Rest(char *name) {
} }
int Save_Init() { int Save_Init() {
u32 add; u32 add;
int per; int per;
int len; int len;
if(savetype == 3) { if(savetype == 3) {
u8 reg;
// Unlock block 0 (0x0 to 0x8000). Seems to only be possible if WP# is lifted though! // Courtasy of Nat (nathaantfm)
spiTransfer(0, 0, 1, 0x6); // Send write enable
spiTransfer(0, 0, 2, 0x1, 0x0); // Write status register bits 7-0
do { spiTransfer(1, &reg, 1, 0x5); } while (reg & 0x1); // Read status register // Write in progress
dsp_bar(3, -1); dsp_bar(3, -1);
for(add = 0; add < savesize; add += 0x10000) { for(add = 0; add < savesize; add += 0x10000) {
per = (add * 100) / savesize; per = (add * 100) / savesize;

View File

@ -58,7 +58,7 @@ extern uint16* SubScreen;
#define BG_256_COLOR (BIT(7)) #define BG_256_COLOR (BIT(7))
#define VERSION "v1.1" #define VERSION "v1.2"
#define VERSIONOFFSET (37*6) #define VERSIONOFFSET (37*6)
char GameTitle[13]; char GameTitle[13];
@ -959,9 +959,9 @@ void mainloop(void) {
while(cmd != -1) { while(cmd != -1) {
if(fl != (CMDmode & 2)) { if(fl != (CMDmode & 2)) {
DrawBox(MainScreen, 0, FILEY*12, 255, 191, RGB15(31,31,31), 1); DrawBox(MainScreen, 0, FILEY*12, 255, 191, RGB15(31,31,31), 1);
ShinoPrint(MainScreen, 42, 90, (u8 *)t_msg[2], RGB15(31,31,31), RGB15(31,0,0), 1); ShinoPrint(MainScreen, 42, 90, (u8 *)t_msg[2], RGB15(31,31,31), RGB15(8,8,8), 1);
ShinoPrint(MainScreen, 42, 102, (u8 *)t_msg[3], RGB15(31,31,31), RGB15(31,0,0), 1); ShinoPrint(MainScreen, 42, 102, (u8 *)t_msg[3], RGB15(31,31,31), RGB15(8,8,8), 1);
ShinoPrint(MainScreen, 42, 114, (u8 *)t_msg[2], RGB15(31,31,31), RGB15(31,0,0), 1); ShinoPrint(MainScreen, 42, 114, (u8 *)t_msg[2], RGB15(31,31,31), RGB15(8,8,8), 1);
numFiles = SD_FileList(); numFiles = SD_FileList();
fl = 0; fl = 0;
} }

Binary file not shown.