The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other Beginning Hacking (Gen 1)

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #51   Link to this post, but load the entire thread.  
Old November 4th, 2015 (7:38 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So being the genius that I am, changed a bunch of things at once and glitched my game out.

In the interest of fixing this issue, I'll describe it as best I can. The game runs as normal, but upon getting to the intro screen with the revolving Mons, it freezes up after a couple of sprites. It seems like it can't load CERTAIN images correctly. I can correlate this because if I load a save state, it plays as normal, until I enter a battle or view particular Mons in my party or DEX. And it's only certain Mons too.

I changed a lot of the pokemon PNGs in the PIC folder. I changed them back to their originals, but it didn't have any effect. I switched some moves associated with TMs, but I don't think that had much to do with it either.

Is there anything else I should be looking for? I was getting pretty close to finishing up...Damn.
Reply With Quote
  #52   Link to this post, but load the entire thread.  
Old November 10th, 2015 (6:33 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Still no progress with this. I tried clearing out the home folder, then copy and pasting the master files back into it and recompiling. Same issue.

What also gets me is that some of the Mons whose PNGs I changed initially did not lag or crash the ROM, but also did not actually change in game. Case in point: I switched Metapod to the Green version PNG, and it still loaded the one from Red version without any lag. Does anyone have any clues as to what's going on?
Reply With Quote
  #53   Link to this post, but load the entire thread.  
Old November 12th, 2015 (11:04 PM). Edited November 13th, 2015 by Fotomac.
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
As I try to make it so my hack allows the player to pick up all three Starters, I came up with this script:

CeruleanPokecenterText5:
TX_ASM
ld a, [wExtraFlags]
bit 0, a ; got unchosen Starter?
ld hl, .MeetOakAideText
call PrintText
ld a, [wPlayerStarter]
cp CHARMANDER
jr z, .charmander
cp SQUIRTLE
jr z, .squirtle
; else Bulbasaur
lb bc, SQUIRTLE, 5
jr nz, .showText
.charmander
lb bc, BULBASAUR, 5
call GivePokemon
jr nz, .showText
.squirtle
lb bc, CHARMANDER, 5
.showText
call GivePokemon
jr nc, .comeBackLater
; else
ld hl, .OakAideFarewellText
call PrintText
ld hl, wExtraFlags
call SetSpriteMovementBytesToFF
ld a, [wXCoord]
cp $14
jr nz, .asm_*****
ld de, CeruleanPokecenterMovement2
jr .asm_*****
.asm_*****
ld de, CeruleanPokecenterMovement1
.asm_*****
ld a, $1
ld [H_SPRITEINDEX], a
call MoveSprite
ld a, $3
ld [wCeruleanPokecenterCurScript], a
ret
.comeBackLater
ld hl, TooManyPokemon
call PrintText
jp TextScriptEnd

However, I still feel this text is a bit incomplete. What name or number should I give the ASM variables, which signify the Oak Aide's movements?

ETA: Never mind, I think I got it.
__________________
I may be more of a Genwunner, but I still host a Gen VI fansite dedicated to Gen VI walkthroughs and game scripts among other things Gen VI:
http://pokemongen6.shoutwiki.com
Work-in-progress, but feel free to contribute!
Reply With Quote
  #54   Link to this post, but load the entire thread.  
Old November 13th, 2015 (1:13 PM).
Schattenjager's Avatar
Schattenjager Schattenjager is offline
 
Join Date: May 2015
Posts: 9
Quote:
Originally Posted by Imafruitbat View Post
So being the genius that I am, changed a bunch of things at once and glitched my game out.

In the interest of fixing this issue, I'll describe it as best I can. The game runs as normal, but upon getting to the intro screen with the revolving Mons, it freezes up after a couple of sprites. It seems like it can't load CERTAIN images correctly. I can correlate this because if I load a save state, it plays as normal, until I enter a battle or view particular Mons in my party or DEX. And it's only certain Mons too.

I changed a lot of the pokemon PNGs in the PIC folder. I changed them back to their originals, but it didn't have any effect. I switched some moves associated with TMs, but I don't think that had much to do with it either.

Is there anything else I should be looking for? I was getting pretty close to finishing up...Damn.
Not worth quitting since this is probably something extremely trivial. You're just overlooking it. It obviously has to do with the sprites. Could do a rundown on what exactly it was that you did? What pics did you change, and how?
Reply With Quote
  #55   Link to this post, but load the entire thread.  
Old November 14th, 2015 (1:37 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Quote:
Originally Posted by Imafruitbat View Post
Still no progress with this. I tried clearing out the home folder, then copy and pasting the master files back into it and recompiling. Same issue.

What also gets me is that some of the Mons whose PNGs I changed initially did not lag or crash the ROM, but also did not actually change in game. Case in point: I switched Metapod to the Green version PNG, and it still loaded the one from Red version without any lag. Does anyone have any clues as to what's going on?
Is there anywhere that I can look at what you've done and preferably build the ROM to debug it? Hard to tell what's wrong without being able to see it.
Reply With Quote
  #56   Link to this post, but load the entire thread.  
Old November 18th, 2015 (2:04 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
I'll break down what I did with the images:

So there are these folders under "pics" called "bmon", "rgmon", etc. The hold the red/blue sprites and japanese 3rd cart sprites respectively. I simply moved many of the rgmon sprite PNGs into the bmon folder, figuring the game would simply read the new PNGs since I removed the ones in bmon initially.

Checking in the pokemon basestats folder, each file points to a "monname.pic" file, and that file type is only present bmon, meaning there isn't anything else I can replace.

Quote:
Originally Posted by Crystal_ View Post
Is there anywhere that I can look at what you've done and preferably build the ROM to debug it? Hard to tell what's wrong without being able to see it.
What would you suggest as far as getting you access? I don't know how to make an IPS file, not that it's even what you need, come to think of it. I could always save a copy of the home/""/pokered directory, compress it, and send it in a PM or email, unless its too big?
Reply With Quote
  #57   Link to this post, but load the entire thread.  
Old November 18th, 2015 (3:32 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Assuming you have a repo cloned or forked from pokered you can download Github for Windows, add your repository, and then upload it to github publically. It's very straightforward with the graphical interface. Plus if you were using version control you would've been able to get rid of the bug by just reverting back to an older commit in just a couple of clicks.

Because you said that you've already tried switching the pics back to how they were originally, but the problem still stays?
Reply With Quote
  #58   Link to this post, but load the entire thread.  
Old November 18th, 2015 (4:24 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Quote:
Originally Posted by Crystal_ View Post
Because you said that you've already tried switching the pics back to how they were originally, but the problem still stays?
Ya. I also tried to change the order of some Mons in the pokedex, which may also be related (I believe I may have tried flipping 2 Mons in the pokemon_constants.asm, which may have been a mistake). The problem persisted even with the blank slate ROM though.

Let me work on getting that github thing running.
Reply With Quote
  #59   Link to this post, but load the entire thread.  
Old November 18th, 2015 (5:06 PM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
OK, I know where in core.asm to alter the code to correct the Freeze condition, but I don't know exactly how. I mean, I know what to do, I just don't know how to do it.
__________________
I may be more of a Genwunner, but I still host a Gen VI fansite dedicated to Gen VI walkthroughs and game scripts among other things Gen VI:
http://pokemongen6.shoutwiki.com
Work-in-progress, but feel free to contribute!
Reply With Quote
  #60   Link to this post, but load the entire thread.  
Old November 18th, 2015 (5:21 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
github is not as easy to use as I expected. Even though I've added my edited pokered folder as a repository, I can't seem to jump the files to my new repository. It (thankfully) won't let me commit changes, because apparently my pokered folder is still tied to the original pokered disassembly repository. I'd hate to screw up everything for everyone else.

Quote:
Originally Posted by Fotomac View Post
OK, I know where in core.asm to alter the code to correct the Freeze condition, but I don't know exactly how. I mean, I know what to do, I just don't know how to do it.
I would just try to add the turn counter code from the sleep section in the appropriate place in the freeze section and leave everything else be. Of course, this is coming from someone who doesn't really know what they're doing.
Reply With Quote
  #61   Link to this post, but load the entire thread.  
Old November 18th, 2015 (5:30 PM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
Quote:
Originally Posted by Imafruitbat View Post
I would just try to add the turn counter code from the sleep section in the appropriate place in the freeze section and leave everything else be. Of course, this is coming from someone who doesn't really know what they're doing.
Could anyone tell me exactly where in the freeze section to put the sleep (or, in this case, freeze) counter?
Reply With Quote
  #62   Link to this post, but load the entire thread.  
Old November 19th, 2015 (2:46 AM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Initialize the freeze counter at the point of the freeze/paralyze/burn effect function where the freeze status is set. Just grab a couple of unused ram address and initialize one or another depending on whose turn it is.
Then, during the check player/enemy status conditions function, your freeze status would act similar to the sleep status. Decrement the counter by 1 if the turn's pokemon is frozen and defrost it if it hit 0, just like what happens with sleep.

Quote:
I could always save a copy of the home/""/pokered directory, compress it, and send it in a PM or email, unless its too big?
Upload it to dropbox, mediafire or wherever you want so that I can download, check it out and build the rom if necessary.
Reply With Quote
  #63   Link to this post, but load the entire thread.  
Old November 19th, 2015 (1:52 PM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
Quote:
Originally Posted by Crystal_ View Post
Initialize the freeze counter at the point of the freeze/paralyze/burn effect function where the freeze status is set. Just grab a couple of unused ram address and initialize one or another depending on whose turn it is.
Then, during the check player/enemy status conditions function, your freeze status would act similar to the sleep status. Decrement the counter by 1 if the turn's pokemon is frozen and defrost it if it hit 0, just like what happens with sleep.
OK, how does this look?

.freeze
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
ld a, 1 << FRZ
ld [wEnemyMonStatus], a
.setFreezeCounter
call BattleRandom
and $7
jr z, .setFreezeCounter
ld [de], a
ld a, ANIM_A9
call PlayBattleAnimation
ld hl, FrozenText
jp PrintText

And how in Arceus's name is my Quick Reply token expiring so quickly, that I'm forced to reply the hard way?
Reply With Quote
  #64   Link to this post, but load the entire thread.  
Old November 19th, 2015 (2:32 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Expiring?

Crystal, do you have a DB account? If you send me your account name or whatever I'll add you to the appropriate folders. You can send it as a PM if you're worried about privacy.
Reply With Quote
  #65   Link to this post, but load the entire thread.  
Old November 20th, 2015 (4:41 AM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
Quote:
.freeze
call ClearHyperBeam ; resets hyper beam (recharge) condition from target
ld a, 1 << FRZ
ld [wEnemyMonStatus], a
.setFreezeCounter
call BattleRandom
and $7
jr z, .setFreezeCounter
ld [de], a
ld a, ANIM_A9
call PlayBattleAnimation
ld hl, FrozenText
jp PrintText
What is de?

Quote:
Crystal, do you have a DB account? If you send me your account name or whatever I'll add you to the appropriate folders. You can send it as a PM if you're worried about privacy.
Just PM me the link to download it
Reply With Quote
  #66   Link to this post, but load the entire thread.  
Old November 20th, 2015 (1:52 PM).
Fotomac's Avatar
Fotomac Fotomac is offline
Genwunner and proud of it
 
Join Date: Aug 2015
Gender: Male
Nature: Hardy
Posts: 909
Quote:
Originally Posted by Crystal_ View Post
What is de?
I believe that was from the sleep counter. Should I delete that line for the freeze counter?
Reply With Quote
  #67   Link to this post, but load the entire thread.  
Old November 20th, 2015 (3:00 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
I suggest you pick up a GB assembly tutorial before you attempt this kind of stuff. Not to sound harsh but if you don't understand what you're doing you're always going to need someone to do it for you and you won't learn anything in the process. You need to get a basic hang on what the common instructions do before you start messing around with assembly edits. This is definitely a good tutorial, everything is explained quite well: http://gameboy.mongenel.com/asmschool.html

Give the first four lessons a read and try to find out why that random ld [de], a instruction you have there is not doing anything good.
Reply With Quote
  #68   Link to this post, but load the entire thread.  
Old November 22nd, 2015 (7:51 AM). Edited November 22nd, 2015 by Imafruitbat.
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Thanks to Crystal_'s genius help, I know what the issue with my hack was. Hopefully those can be avoided in the future.

HOWEVER, now that its working about like it should, I can't get the game to pull my swapped pokemon sprites. It only pulls the original RB sprites, even though I replaced the ones in the bmon folder that each basestats file seems to point to. If anyone has any hints I'd appreciate it, but since it runs correctly again I can live without it if it's not a pretty simple fix.

Also, does anyone know if adding extra lines to any of the core asm's will move any following data around in a problematic way? I believe I've avoided it so far, but if there are any general rules they might be handy.
Reply With Quote
  #69   Link to this post, but load the entire thread.  
Old November 22nd, 2015 (3:16 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
The problem with the base stats structure is that it has a fixed size so the game would usually be retrieving data using a simple calculation with the index and size values instead of from a table of pointers. It assumes that the size of all entries match as otherwise the calculation will output an incorrect (shifted) memory location. On the other hand, you'll be fine moving and adding asm code since there's no longer any static reference to functions or memory locations. They're just different things.

The sprite pointers in the base stats data point to these: https://github.com/pret/pokered/blob/master/main.asm#L5137. This is where you'd have to change stuff. The INCBIN in the base stats is only incuding the sprite dimensions byte.
Reply With Quote
  #70   Link to this post, but load the entire thread.  
Old November 22nd, 2015 (5:41 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Cool! Tested it a couple ways, pointing to PNGs doesn't work (I seem to recall ROMbase had a special file type for sprites) so I successfully pointed to the rgmon folder instead and voila!

I'm sending a few of my buddies this version of the ROM for phase one play testing!
Reply With Quote
  #71   Link to this post, but load the entire thread.  
Old November 26th, 2015 (8:26 AM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So testing is going well, finding minor issues and correcting them as I go, although I'm getting a cygwin error that says it's "unable to load fixed ROMX section into bank $09". I checked for ROMX in the main.asm, but can only find bank "$9" not "$09". There's not much in "$9", and it's stuff that would have given me problems long before now.

I figure bank "$09" refers to one of the named ROMX banks, like "pics" or something, but I have no idea which one to look at. Cygwin isn't giving me a asm line to look for either.

I'm also looking into a release pokemon function outside of the regular Bill's PC (which might be more than I can handle) in which case, I'd settle for just adding PC access someplace else (although I can't find references for that either). I would've thought the script would have been tied to a map object or would check for the PC tile before starting, but am not having any luck.

Direction?
Reply With Quote
  #72   Link to this post, but load the entire thread.  
Old November 26th, 2015 (12:27 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
It means that what you're trying to fit into bank 9 is too large to fit into a single bank. Bet you've messed around with pics in bank 9 (PICS_9) and there's not enough space in that bank. You'll have to move some to another bank and account for it in the sprite loading function (so that each mon reads its pic from its corresponding bank).
If you're getting an error nothing is being saved to the ROM until you fix the build so all the stuff you've modified since hasn't still been updated.
Reply With Quote
  #73   Link to this post, but load the entire thread.  
Old November 26th, 2015 (1:33 PM). Edited November 26th, 2015 by Imafruitbat.
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
Quote:
Originally Posted by Crystal_ View Post
It means that what you're trying to fit into bank 9 is too large to fit into a single bank. Bet you've messed around with pics in bank 9 (PICS_9) and there's not enough space in that bank. You'll have to move some to another bank and account for it in the sprite loading function (so that each mon reads its pic from its corresponding bank).
If you're getting an error nothing is being saved to the ROM until you fix the build so all the stuff you've modified since hasn't still been updated.
Like the files it's trying to load are too big, or there is now extra files that don't fit?

Problem is there's no PICS_9 bank in main.asm. There's 5 of them, but they're not consecutive nor do any of them fall 9th in the overall order of banks, so far as I can tell. The ones that look like they could be bank 9 or 9th in order are banks I've never messed with.


**EDIT: Partially resolved. I changed a handful of sprites back to their originals and all banks loaded correctly. This points to my first guess about actual memory and not number of lines. However, I feel like I can't just haphazardly move things from one bank to another. Or maybe I can, so long as I adjust everything else for the bank changes like you're saying.
Reply With Quote
  #74   Link to this post, but load the entire thread.  
Old November 26th, 2015 (3:29 PM).
Crystal_ Crystal_ is offline
 
Join Date: Feb 2013
Location: Spain
Gender: Male
Posts: 170
My guess is that you either added more sprites to bank 9 (see PICS_1 in main.asm), or chances are, you replaced some sprites with other that are bigger.

The pokemon sprites are splitted in five banks (9, A, B, C, D), and there's probably not much extra space to make room for additional or larger sprites. Have a look at this tutorial on how to add a new Pokemon from Dannye (https://github.com/pret/pokered/commit/16d9ec3) to see how he added a sprite to a different bank and how he reflected it in the UncompressMonSprite function. Specifically, look at changes in home.asm and main.asm. These are all you need.
Reply With Quote
  #75   Link to this post, but load the entire thread.  
Old November 26th, 2015 (8:18 PM).
Imafruitbat Imafruitbat is offline
 
Join Date: Sep 2015
Posts: 56
So creating a new bank in the main.asm isn't an issue? Seems simple enough to do, so long as there is no issues of data being moved in problematic ways or things overlapping each other, which I'm afraid of, since many times I'm not keen to them.
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 9:25 AM.