• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Script✓] Port the "New game adventure intro" from FireRed to Emerald?

セケツ

ポケハック初心者
61
Posts
7
Years
    • Seen today
    Hello everyone.
    In PokeFireRed/LeafGreen, when choosing to start a new game or start the game with no save file. After the explanation of the all buttons' usages, a new game adventure intro will appear before Prof. Oak's speech.
    Port the "New game adventure intro" from FireRed to Emerald?

    And Now I want to port this feature to my pokeemerald decomp files. I have looked through the pokefirered decomp file, and finally found this feature lying in the "src/oak_speech.c" file. Mainly controlled by two functions named "Task_OakSpeech6" and "Task_OakSpeech7".
    However, when I finally put it into pokeemerald's "main_menu.c" file. I found that there were some unknown functions like "Unk_0012", "Unk_0008" related to sprites and resources, which I know nothing about.
    Port the "New game adventure intro" from FireRed to Emerald?

    Here is my question: Is there any possibility to port this feature to pokeemerald decomp file? If it can be done, could anybody help me with it?
    Thanks again with all assistance.
     
    Last edited:

    セケツ

    ポケハック初心者
    61
    Posts
    7
    Years
    • Seen today
    Well, I have made a little progress in this problem after several hours...
    I tried to port the whole codes of this feature, correcting the descriptions, fixing the conflicts, and then compounded the ROM.
    Finally I got this, not a total failure...
    Port the "New game adventure intro" from FireRed to Emerald?

    At least the Pikachu and the first part of the text was there, but the background is simply black.
    What's more, When I push the A button, it became crashed. No matter how I pushed Button A or Button B, it still stuck in there and did not move towards the next step.
    Port the "New game adventure intro" from FireRed to Emerald?

    Till now, I still don't know the reason why I had come into this failure, but it might have something to do with the "unk_0012" lying in the "Oakspeechresources" function.
     
    Last edited:

    ellabrella

    PKMN Trainer
    57
    Posts
    5
    Years
    • She/It
    • Seen Apr 17, 2024
    sOakSpeechResources in pokefirered's src/oak_speech.c is a variable, not a function. it's a struct, which is a type of variable that is like a container for a bunch of other variables. if you scroll up to the top of the file you should see a description of what this struct contains. the "unk_" name just means that pret, the group making the pokefirered decomp, hasn't named that variable yet. but you can still sorta figure out what unk_ variables are doing based on their types and how they're used.

    unk_0008 is a void pointer. that means it can store a reference to any other piece of data. it looks to me like they use unk_0008 in the process of loading some graphics. so you should definitely take a careful look at how you're handling unk_0008 in your port.

    unk_0012 is a u16. in case you don't know, that's an unsigned 16-bit integer - so, a whole number which isn't negative, and can be as big as 65535. in OakSpeech7, we can see that pressing the A button increases unk_0012, and pressing the B button decreases it. and once it reaches 3, it tells the game to move ahead to state 4, which seems to handle transitioning from OakSpeech7 to OakSpeech8. so i think it's pretty safe to say that unk_0012 stores the current page number in this function. if you're getting garbage text and a game crash when you try to change the page, it could definitely be something wrong with unk_0012.

    unk_0014 seems to be something to do with the window system, which is used for printing text. i can't help much with this off the top of my head as i don't know a lot about the window system.

    if you still need help, it might be a good idea to share your code! you can use a website like pastebin to send a text file: https://pastebin.com/
     

    セケツ

    ポケハック初心者
    61
    Posts
    7
    Years
    • Seen today
    sOakSpeechResources in pokefirered's src/oak_speech.c is a variable, not a function. it's a struct, which is a type of variable that is like a container for a bunch of other variables. if you scroll up to the top of the file you should see a description of what this struct contains. the "unk_" name just means that pret, the group making the pokefirered decomp, hasn't named that variable yet. but you can still sorta figure out what unk_ variables are doing based on their types and how they're used.

    unk_0008 is a void pointer. that means it can store a reference to any other piece of data. it looks to me like they use unk_0008 in the process of loading some graphics. so you should definitely take a careful look at how you're handling unk_0008 in your port.

    unk_0012 is a u16. in case you don't know, that's an unsigned 16-bit integer - so, a whole number which isn't negative, and can be as big as 65535. in OakSpeech7, we can see that pressing the A button increases unk_0012, and pressing the B button decreases it. and once it reaches 3, it tells the game to move ahead to state 4, which seems to handle transitioning from OakSpeech7 to OakSpeech8. so i think it's pretty safe to say that unk_0012 stores the current page number in this function. if you're getting garbage text and a game crash when you try to change the page, it could definitely be something wrong with unk_0012.

    unk_0014 seems to be something to do with the window system, which is used for printing text. i can't help much with this off the top of my head as i don't know a lot about the window system.

    if you still need help, it might be a good idea to share your code! you can use a website like pastebin to send a text file: https://pastebin.com/

    First, Thank you for spending time answering my question & pointing out my misunderstandings in patience. Since I am a beginner of DecompRomHacking, I still need a lot to learn.
    After reading what you wrote, I believe there must be something wrong with "Unk_0008" pointer, Therefore, I tried to delete it pointer at the line loading the tilemap of "sOakSpeechResources", and to my surprise, the palette of the introduction itself was loaded and the three parts of text rolled perfectly, making the game continued to the birch's speech.
    The only glitch here was that the titlemap of the background didn't display correctly, except which everything went well.
    Port the "New game adventure intro" from FireRed to Emerald?

    What's more, to make the code itself more simple, I had deleted some unnecessary functions in the original code, such as the Top bar, the strings above displaying the text of button A & B, and the wide cursor specified for Firered to display at the right below.
    Since I am a beginner in DecompRomhacking, the way I ported this feature to the was nothing but tried pasting the code to from "oak_speech.c" file from PokeFireRed to the "main-menu.c" file in Pokeemerald, making some changes to the names & explanations of functions, and add declaration for them in order to make it fit for the file.
    All in all, very appreciate for your help, thank you sincerely!
     

    セケツ

    ポケハック初心者
    61
    Posts
    7
    Years
    • Seen today
    Finally, I managed to solve this based on a shallow & general understanding of the whole structure of the codes & plenty of useless failures.
    Here is the result I get, the text & background itself appear properly.

    Port the "New game adventure intro" from FireRed to Emerald?


    The 3 parts of the whole text scroll up/ down in order just as they should in the original Firered. Moreover, the disappearance of text when pushing the button also works as well.

    Port the "New game adventure intro" from FireRed to Emerald?


    Port the "New game adventure intro" from FireRed to Emerald?


    Port the "New game adventure intro" from FireRed to Emerald?


    However, compared with the original, there are still two things not showing up in my port: the blue top bar containing the explanation of buttons & the wide cursor that specific for the Firered. Since I haven't found them in the emerald decomp files (The things I only found were two png graphics of them) I finally decided to delete the declaration & usage for both of them & keep them away from the whole function.

    Port the "New game adventure intro" from FireRed to Emerald?


    Sorry for my ignorance & disturb. And thank all the persons that helped/wanted to help me with this problem sincerely.
     
    Last edited:
    Back
    Top