Homebrew programming question

  • Thread starter Thread starter pka4916
  • Start date Start date
  • Views Views 1,568
  • Replies Replies 7

pka4916

Well-Known Member
Member
Joined
May 24, 2006
Messages
206
Reaction score
4
Trophies
1
Location
USA
XP
425
Country
United States
hi, hope someone can help me with this,

I'm trying to find out how to get the picture out of the rom
and determ what the trimsize could be.

i am thinking that from reading on
http://www.bottledlight.com/ds/index...mats/NDSFormat

that this will show the size?
ROM size 0x080 0x083 4 0x00EE3E44

how can i calculate those values to get the right trim size?
i tried several things, but it just doesnt add up.

maybe someone can help me out with this.
I am using Delphi btw.

thank you so much
 
You need to understand exactly how it works to get the trim size, yes those are the correct locations in the rom for finding the trim size, but it needs to be reversed, so the trimsize will be 0x083 + 0x082 + 0x081 + 0x080, not the other way around.

After you figure that, it will give the proper rom length in hex.
 
so,

I had this (from rom DQM) 128mb and trimsize = 83.5 mb (according to rominator)


GRomsize: array [0..3] of Byte


Seek(129,0); (pos 129 in the rom file)
Read(gromsize,4); read the 4 bytes

result is (180, 56, 5, 0)

so reading it back wards would be 0 , 5 , 56, 180

what do i need to do from here then? since i was making it 556180 as size
but don't know if it bytes,kb,mbit
 
pka4916 said:
so,

I had this (from rom DQM) 128mb and trimsize = 83.5 mb (according to rominator)


GRomsize: array [0..3] of Byte


Seek(129,0); (pos 129 in the rom file)
Read(gromsize,4); read the 4 bytes

result is (180, 56, 5, 0)

so reading it back wards would be 0 , 5 , 56, 180

what do i need to do from here then? since i was making it 556180 as size
but don't know if it bytes,kb,mbit
http://en.wikipedia.org/wiki/Endianness
You're trying to read a 4-byte word in little endian.

unsigned int result = (b[3]
 
pka4916 said:
after reading the wiki, i am more confused now.

Maybe should start with something a little more simpler?
smile.gif
 
The following should do what you want, given that the rom is at rom.nds in the same directory. Since your last post was 3 days ago, you likely figured out your problem, but I was bored so I decided to write up the code anyways.

Code:
program DataFiles;

var
ÂÂÂÂf: file of byte;
ÂÂÂÂb1: byte;
ÂÂÂÂb2: byte;
ÂÂÂÂb3: byte;
ÂÂÂÂb4: byte;
ÂÂÂÂli: longint;

begin
ÂÂÂÂassign(f,'rom.nds');
ÂÂÂÂreset(f);

ÂÂÂÂseek(f,128);
ÂÂÂÂread(f,b1);
ÂÂÂÂread(f,b2);
ÂÂÂÂread(f,b3);
ÂÂÂÂread(f,b4);
ÂÂÂÂclose(f);

ÂÂÂÂli := (b4 shl 24) or (b3 shl 16) or (b2 shl 8) or b1;

ÂÂÂÂwrite(li);
end.
 

Site & Scene News

Popular threads in this forum