Hacking EZ-FLASH OMEGA kernel source code released

fengflash

New Member
Newbie
Joined
Jul 7, 2018
Messages
4
Trophies
0
Age
21
XP
87
Country
China
My plan is to at least get something working before planning the best course of action.

I'm not afraid to brick the Omega as it has the recovery mode - I did indeed screw up the device yesterday messing around with this stuff (so it certainly is dangerous), but recovery mode saved my bacon.

Because of how dangerous these calls are, it could be that it's best to play it safe and wrap them in minimal OS mode switches - haven't settled on this. My plan is to make an open-source library that people can use with their GBA game development to access the Omega's file-system. After a formal library is created, then I am thinking about adding the support for the Omega's file-system in a popular open-source GBA emulator, which would absolutely help out GBA ROM developers.

EDIT: To answer your actual question (sorry I was rambling there) this code is just to initialise the file system and print out if it worked out not. 100% of the code is running in IWRAM, just to make sure it's not an issue with ROM execution, but if it does switch from ROM execution it absolutely needs to return to it.

...
//SD_Disable();
SD_Enable();
FRESULT res = f_mount( &FileSystem, "", 1 );

...
u32 IWRAM_CODE Read_SD_sectors(u32 address,u16 count,u8* SDbuffer)
{
SetRompage(0x8000);//change to OS mode
SD_Enable();
...

SD_Disable();
SetRompage(0x200);//return to game mode on PSRAM
//SetRompage(0x00);//return to game mode on NOR first slot address
return 0;
}
 
  • Like
Reactions: Sterophonick

Xilefian

Member
Newcomer
Joined
Nov 11, 2010
Messages
19
Trophies
0
XP
71
Country
...
//SD_Disable();
SD_Enable();
FRESULT res = f_mount( &FileSystem, "", 1 );

...
u32 IWRAM_CODE Read_SD_sectors(u32 address,u16 count,u8* SDbuffer)
{
SetRompage(0x8000);//change to OS mode
SD_Enable();
...

SD_Disable();
SetRompage(0x200);//return to game mode on PSRAM
//SetRompage(0x00);//return to game mode on NOR first slot address
return 0;
}
Nice! Thank you very much fengflash, this code makes it nice and clear and I've got a test working now. Thank you again.

Now to write code to detect PSRAM/NOR loaded game. Thank you again for your help.
 

nl255

Well-Known Member
Member
Joined
Apr 9, 2004
Messages
2,965
Trophies
0
XP
2,244
Country
repo

Since the early days of OMEGA development, we have set a goal for open source in the future. The entire project uses DevKit Pro development instead of the previously used "Big N SDK".

We sincerely hope that the developers of the community will use their inspiration to create a more convenient and humane OS.

Very nice, thank you.

Would it be possible to open source the code that handles DS game support on the older EZ-Flash devices? Especially any anti-AP code(s) used to get newer DS games (SDK 4-5) working on the GBA slot carts (ez3/ez4)?
 

Dimensional

Well-Known Member
Member
Joined
Dec 7, 2008
Messages
936
Trophies
0
Age
31
Location
Texas
XP
1,858
Country
United States
Nice! Thank you very much fengflash, this code makes it nice and clear and I've got a test working now. Thank you again.

Now to write code to detect PSRAM/NOR loaded game. Thank you again for your help.
Why are you trying to do this? Would it by chance be used to allow for DS linkage?
 

Xilefian

Member
Newcomer
Joined
Nov 11, 2010
Messages
19
Trophies
0
XP
71
Country
Why are you trying to do this? Would it by chance be used to allow for DS linkage?
This might rain on your parade a bit, but I doubt "DS linkage" will be possible as the EZ Flash Omega requires the kernel to be booted before the ROM page can be set. Even if there was code that automatically forced a ROM page on boot, the kernel still needs to do that and a DS game (be it Pokemon or whatever) is almost certainly never going to execute the GBA ROM code (so that means no kernel will be booted).

The only way I can ever imagine this working is to first boot the GBA game (so its ROM page is in the memory map) and then somehow switch into the DS game - which I very much doubt is possible.

NOR flash versus PSRAM won't make a difference, the issue is that the code that's at the ROM address of the cartridge is the boot loader for entering the kernel, so a DS game will never be able to find the game it's looking for when the boot loader is in the ROM memory map. DS games that read GBA games usually just read the save file data from those games (I'm pretty sure Pokemon does this) rather than execute code, so if you can get around the game ID checksum you can probably put something in the SRAM memory, but again the game ID of the Omega is not going to be a Pokemon game, it's going to be whatever ID the boot loader reports.

For now, it's best to give up on the idea of "DS linkage" with flash carts, I very much can't imagine them working without some kind of physical hardware switch on the flash cart itself that redirects ROM map to NOR or something (you'd need a brand new type of flash cart built for this).
 
  • Like
Reactions: Axel-MaV

Axel-MaV

Well-Known Member
Newcomer
Joined
Apr 9, 2008
Messages
49
Trophies
0
XP
808
Country
Brazil
I'm working on DevkitPro to do this, I hope it's possible:

test.png
 

kuwanger

Well-Known Member
Member
Joined
Jul 26, 2006
Messages
1,510
Trophies
0
XP
1,778
Country
United States
Thanks for the code update. I bumped my version to the latest. Also, if interested I replaced the Makefile so I can actually compile the code under Linux. Not entirely sure why the old one works under Windows. *shrug*
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    L @ Lopt: Thanks I don’t play animal crossing :(