Main Menu
Main Page
Forums
Recent changes
Random page
Help

Databases
GlitchDex
AttackDex
ItemDex
TypeDex
UnownDex
More

Major Glitches
Trainer escape glitch
Old man trick
Celebi trick
Select glitches (Japan)
SRAM glitch
CoolTrainer♀ corruption
LOL glitch
Rival LOL glitch
Super Glitch
ZZAZZ glitch
Pomeg corruption glitch (Glitzer Popping)
Tweaking
Elite Four door glitch (Japan)
Pokémon merge glitch
Pokémon cloning
Time Capsule exploit
Arbitrary code execution
Coin Case glitch
More

Other Glitch Categories
Glitches by generation
Glitches between two generations
Japan-only/language specific glitches
Music glitches
Natural glitches
Non-core series glitches
Non-Pokémon glitches
Officially acknowledged glitches
Recurring glitches
Dead glitches

References
Pokémon GameShark codes
The Big HEX List
GB programming
Curiosities
Debugging features
Easter eggs
Error traps
Glitch areas
Glitch myths
Non-glitch exploits
Placeholder texts
Pokémon glitch terminology
Unused content and prerelease information

Useful Tools
8F Helper
GBz80 to Items
Old man trick name generator
PATH (Prama's Advanced Tweaking Heaven)
Save file editors
Special stat/Pokémon converter
Trainer escape Trainer Pokémon finder

Affiliates
Legendary Star Blob 2 (Hakuda)
Pokémon Speedruns wiki
PRAMA Initiative
Become an affiliate!

Search Wiki

 

Search Forums

 

Poll

Make it?

Yes.
9 (90%)
No/
1 (10%)

Total Members Voted: 9

Author Topic: Another Crystal Disassembly?  (Read 943 times)

0 Members and 1 Guest are viewing this topic.

Dandaman955

  • GCLF Member
  • Offline Offline
  • Gender: Male
  • CHARIZRAD 'M ROXORX or is it.
    • View Profile
Another Crystal Disassembly?
« on: July 20, 2016, 11:51:36 pm »
Okay, so this is probably the most pointless thread, and I don't know how to make polls, so with that in mind:

I was looking through the current Pokemon Crystal disassembly by (I think?) pret, and I found a lot of it quite hard to read through. No disrespect to the work that was put through, but it was covered in equates and macros, with a lot of files split into sub-files which made following a lot of it difficult. Now in the Sonic scene, there are people who swear by two different types of disassemblies, often disagreeing on which is the best kind, with:-

- The up-to-date Git kind, where it is all macroed, equated and has code split into separate files, similar to how the Crystal disassembly is now. I think it's trying to be similar to how something like C handles it, with the includes and such?

- The one that isn't. Simple. :p

I personally believe that you can make a disassembly less cluttered by reducing the amount of equates, macros and file splits and replacing them with comments denoting what the instructions do in the grand scheme of things. Here's[1] an example of one disassembly I made (That isn't finished; Some instructions aren't commented and a lot of data isn't split into files yet, mainly the large block of data, from byte_100C to loc_6B48, with a few things otherwise. It should give an idea, though.) on the Action Replay ROM. I was thinking of making a disassembly with a similar structure to this one, but I don't think it's worth the effort if there isn't anyone who would actually find a use in it, so what I'm basically asking here is:

Would you be interested in/use a disassembly like this?

[1] - https://github.com/Dandaman955/Action-Replay-MD-Disasm/blob/master/Action%20Replay%20(Europe).asm

Yeniaul

  • Guest
Re: Another Crystal Disassembly?
« Reply #1 on: July 20, 2016, 11:57:04 pm »
In short? f**k yes.
This'd be perfect for an upcoming project of mine. (Hint, hint. :D)

Dandaman955

  • GCLF Member
  • Offline Offline
  • Gender: Male
  • CHARIZRAD 'M ROXORX or is it.
    • View Profile
Re: Another Crystal Disassembly?
« Reply #2 on: July 21, 2016, 12:16:28 am »
Oh, you have to post to make the poll.

Anyways, I guess I can chalk one down for yes!

TheZZAZZGlitch

  • Distinguished Member
  • *
  • Offline Offline
  • Gender: Male
  • Unknown opcode fc at 801a
    • View Profile
Re: Another Crystal Disassembly?
« Reply #3 on: July 21, 2016, 12:17:45 am »
Definitely. A one-file disassembly is a lot easier to search through when you want to analyze a certain subroutine or check for certain behavior.
The current disasms of Pokemon games are formatted like "corporate quality code", which is good for ROM hacking, but not too good for reversing. A similar thing happened to the pokered disassembly. I circumvented the problem by getting an older version of the repository, where everything was still mostly in one file. But this old version has a lot of stuff undocumented, so later I need to search through the current version anyways.

An easy way to get a one-file disasm would be writing a quick script to expand all of the includes. Still, that wouldn't deal with macros and constants (looking through the code, minding my own business... f**k, what address is wWhichPokemon again? *scroll back to the top*)
qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF

Wack0

  • Coder, reverser, beta collector [BetaArchive staff]
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • cBRH - Doing nothing since 2k7
    • View Profile
Re: Another Crystal Disassembly?
« Reply #4 on: July 21, 2016, 02:41:34 am »
I second TheZZAZZGlitch.
C H E C K E D . B U I L D S . A R E . A W E S O M E N E S S

BetaArchiveSoftHistory Forumsirc.rol.im #galaxy,#softhistory

Also known as The Distractor.

Shane, please stop telling children that there's a Mew outside under the delivery trucks. - Management

Pokémon: arbitrary code execution 1996-2016

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Another Crystal Disassembly?
« Reply #5 on: July 21, 2016, 05:56:20 am »
It would also be nice if the same happened for Red and Yellow ; but, one thing at a time, so I heavily say YES to this one.
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

Wack0

  • Coder, reverser, beta collector [BetaArchive staff]
  • Staff
  • *****
  • Offline Offline
  • Gender: Male
  • cBRH - Doing nothing since 2k7
    • View Profile
Re: Another Crystal Disassembly?
« Reply #6 on: July 21, 2016, 07:24:36 am »
I just realised, compiling the disassembly would produce a symbol or map file, that I know that bgb at least can read to get symbol names (so you can ctrl+g <label> and it'll jump to the address etc).

That could be used instead of having an entirely new disasm.
C H E C K E D . B U I L D S . A R E . A W E S O M E N E S S

BetaArchiveSoftHistory Forumsirc.rol.im #galaxy,#softhistory

Also known as The Distractor.

Shane, please stop telling children that there's a Mew outside under the delivery trucks. - Management

Pokémon: arbitrary code execution 1996-2016

ISSOtm

  • The French Lord of Laziness (and a huge The Legend Of Zelda fan)
  • Wiki Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Pewter City (B)rocks !
    • View Profile
    • My Little Website
Re: Another Crystal Disassembly?
« Reply #7 on: July 21, 2016, 07:11:38 pm »
I tried generating that file, but I didn't have rgbasm on my Debian system. When I tried to compile it, it required a package I didn't have.
That package didn't exist in the official repos, so I looked for an equivalent.
When running make on rbgasm, the equivalent produced seveal screens worth of synatx errors.

I uninstalled all out of discouragement.


If anyone could give me a link to such a .map file, I'd be ready to give them big, big hug. And a truck filled with Mews chocolate / candies / toffees / sweets.
« Last Edit: July 22, 2016, 06:48:27 am by ISSOtm »
"THOU SHALL NOT PASS !!"  RIVAL's effect, Gandalf.

Proudly glitching Pokémon Red and Yellow on a Black & White GB, Pocket GB, GB Color, GBA SP and new 3DS.

My Twitter (beware, I'm French)
My YouTube (same warning)

Here is an online tool to build 8F setups : GBz80 to Items !

They see me layzin', they ha-tin'...
Heavy contributor of the global augmentation of entropy (my room's is too damn high !)

TheZZAZZGlitch

  • Distinguished Member
  • *
  • Offline Offline
  • Gender: Male
  • Unknown opcode fc at 801a
    • View Profile
Re: Another Crystal Disassembly?
« Reply #8 on: July 22, 2016, 12:51:55 am »
I have a SYM file for Red/Blue, since I use it in bgb to get symbols for debugging.
But it doesn't seem to be of much help when creating a one-file disasm, using it by itself wouldn't preserve comments and differences between data and code. But I still included it as an attachment, since it's useful to have.

Instead, I randomly decided to do something stupid:

Code: [Select]
# coding: utf8
result = b''; counter = 0
with open('out.asm', 'rb') as f:
    for i in f.readlines():
        if i[0:9] == b'INCLUDE "':
            with open(i[9:-3], 'rb') as g: result += g.read()
            counter += 1
        else:
            result += i
with open('out.asm', 'wb') as f: f.write(result)
print("Eradicated includes: %i" % counter)
# run it multiple times to deal with nested includes

And the result looks surprisingly OK. https://aww.moe/u408xw.asm
It still lacks comments with function addresses (this could be done with the SYM file mentioned earlier), and has all the constants and macros (the problem of constants can be fixed by prefixing/suffixing each pointer constant with its effective address; still no idea how to approach the macros, does rgbasm have an command line option to only preprocess macros without compiling?)
qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF qÁF

Yeniaul

  • Guest
Re: Another Crystal Disassembly?
« Reply #9 on: July 22, 2016, 08:48:55 am »
I tried generating that file, but I didn't have rgbasm on my Debian system. When I tried to compile it, it required a package I didn't have.
That package didn't exist in the official repos, so I looked for an equivalent.
When running make on rbgasm, the equivalent produced seveal screens worth of synatx errors.

I uninstalled all out of discouragement.


If anyone could give me a link to such a .map file, I'd be ready to give them big, big hug. And a truck filled with Mews chocolate / candies / toffees / sweets.
Search "rgbasm Debian" and find it on a repo. Look and see if any of the dependency names are links. Download those too, and any dependencies for those you don't have. Install the .deb files, starting with the lowest level of dependencies. (If rgbasm is the highest, and its dependencies are the next highest, what's the lowest level?)

This sounds and IS tedious, but try having to do this without ANY packages. You'd have to install EVERYTHING. If I can install GNUTools on Damn Small Linux, you can do the above process.

I hope you can figure out how to install them, considering all the documentation out there.
« Last Edit: July 22, 2016, 09:01:52 am by Yeniaul »

IIMarckus

  • Administrator
  • *****
  • Offline Offline
  • Gender: Male
  • Impersonal Text
    • View Profile
    • iimarck.us
Re: Another Crystal Disassembly?
« Reply #10 on: July 28, 2016, 01:16:38 am »
Investing a little bit of time in learning how to effectively use tools like git grep and symfiles makes a big difference.