| CODE |
| // gba_namer.cpp : Defines the entry point for the console application. // /* from http://www.work.de/nocash/gbatek.htm#cartridgeheader Header Overview Address Bytes Expl. 000h 4 ROM Entry Point (32bit ARM branch opcode, eg. "B rom_start") 004h 156 Nintendo Logo (compressed bitmap, required!) *****0A0h 12 Game Title (uppercase ascii, max 12 characters)***** 0ACh 4 Game Code (uppercase ascii, 4 characters) 0B0h 2 Maker Code (uppercase ascii, 2 characters) 0B2h 1 Fixed value (must be 96h, required!) 0B3h 1 Main unit code (00h for current GBA models) 0B4h 1 Device type (huh ???) 0B5h 7 Reserved Area (should be zero filled) 0BCh 1 Software version (usually 00h) 0BDh 1 Complement check (header checksum, required!) 0BEh 2 Reserved Area (should be zero filled) --- Additional Multiboot Header Entries --- 0C0h 4 RAM Entry Point (32bit ARM branch opcode, eg. "B ram_start") 0C4h 1 Boot mode (init as 00h - BIOS overwrites this value!) 0C5h 1 Slace ID Number (init as 00h - BIOS overwrites this value!) 0C6h 26 Not used (seems to be unused) 0E4h 4 JOYBUS Entry Pt. (32bit ARM branch opcode, eg. "B joy_start") Note: With all entry points, the CPU is initially set into system mode. */ #include "stdafx.h" #include "iostream" #include "fstream" using namespace std; void read_rom_name(); void write_rom_name(char[]); int _tmain(int argc, _TCHAR* argv[]) { read_rom_name(); return 0; } void read_rom_name() { fstream romfile; char romname[12]; romfile.open ("rom.bin", fstream::in | fstream::out | fstream::binary); romfile.seekp(160); romfile.read(romname, 12); cout << "the rom\'s name is \"" << romname << "\"\n"; romfile.close(); } void write_rom_name(char name[]) { fstream romfile; romfile.open ("rom.bin", fstream::in | fstream::out | fstream::binary); romfile.seekp(160); romfile.write(name,0); cout << "write done! reading out name...\n"; romfile.close(); read_rom_name(); } |