ROM Hack Beginning to Mod an obscure game.

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
cookie-shop-ds.jpg

Hello.

I'm here to start modding a really obscure game called cookie shop. To know further details of the game, you can search Cookie Shop DS on google or other search engines.

My main goal is to create custom stories using the game, however in order to do so, I would have to modify the text files, and when I tried to do so, every time I continue from my previous game, The top shows a black screen and all my controls are locked. I don't know if it's a byte problem or a compilation problem, but hopefully someone can help me.

I am able to extract all the graphics of the file.
 
  • Like
Reactions: jeffyTheHomebrewer

jeffyTheHomebrewer

Neato Burrito!
Member
Joined
Aug 24, 2018
Messages
1,609
Trophies
1
Location
his house!
Website
catboybeebop.neocities.org
XP
3,448
Country
United States
Seems like maybe it could be a byte problem? Try getting the vanilla rom, and a vanilla rom of cookie shop in a different language, and move a text file from the other version into the english version and test it that way. If it still gets a black screen and hangs like that, then it's probably a compiling problem, maybe.
 

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
I found out that by looking into the text files, if I were to look at the first 4 bytes, it will reveal the length of the text file in bytes. (including the first 4 bytes)

However, I realized that the language is stored in bin files. I have gathered the following

offset: VARIABLE // details
0x0-0x3: FILE_LENGTH // File length in bytes
0x4-0x7: SEPERATOR_AMOUNT // The amount of line seperators in the text.
0x8-0xB: SEPERATOR_START // where does the line seperators start
0xC-0xF: TEXT_START// where does the text start
SEPERATOR_START until TEXT_START: TEXT_SEPERATOR 0x## // the line seperators of the text. Each seperator is 4 bytes long. To find where length of the text # that will be inputed, add TEXT_START by the TEXT_SEPERATOR of the line number

example:
in auto_wakeup_eng.bin

FILE_LENGTH: 0xf0h
TEXT_START: 0x44h
SEPERATOR_AMOUNT: 0x1dh
TEXT_SEPERATOR 0x00: 0x00h
TEXT_SEPERATOR 0x01: 0x48h
... (continues until SEPERATOR_AMOUNT)
TEXT_SEPERATOR 0x0d: 0xa1h

The length of "Today is the day of the contest! I have to go to the department store!" is 48 bytes,excluding the quotation marks and including the 00 byte.

I almost forgot about the text stuff, Inside the text, the hex 0A means enter, 20 is space key, and 00 is null.

There the next line, using TEXT_SEPERATOR 0x01, would be programmed to be in 0x44h + 0x48h = 0x8c, and if you check, the next line "Today the announce... (continued)" starts at 0x8ch.

I am unable to program a tool however to generate these types of bin files. I need help and I since I couldn't program bytes properly.



upload_2021-6-25_15-3-27.png


I also found out that the uncompressed LZ bin the text contained shares the NARC format.
So theoretically, I would have to...
1. uncompress the lz77 translation file AND lz77 the original script file, then extract both of the uncompressed bins
2. Rename both bins from .bin to .narc.
3. unpack using crystal tile
4. edit the original script file.
5. get the new length of the script file in bytes and paste it on the first 4 characters before the script name
6. Use a tool of some sort to edit the translation file.
7. replace the files on the corresponding folders
8. repack the narc files and rename the file type back to bin.
 
Last edited by COR3Z,
  • Like
Reactions: jeffyTheHomebrewer

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Interesting format and nice job on getting this far as that is not the simplest format. No magic stamp but relative pointer setup and most of what I would normally expect out of a competent take on a text format. At least you don't have compression beyond that NARC file setup to cause problems. By the way depending upon the program you are using you might not have to decompress and rename -- NARC files were often seen to be compressed and gained the extension CARC instead which some programs will handle, though not sure about CT2.

I will note in your example text there then there are various accented and whatnot characters unique to French. Not all games will support such things. Simple test here (thanks to no compression) is just overwrite one of the normal characters with it -- don't change length or anything. If the game displays what you want, or indeed does not crash before them (some games will crash if they encounter unexpected text), then you have them. If not then you either deal without them or edit the font to include them (usually better to edit existing than add by the way, though if it is NTFR then adding is not the hardest thing).

As far as compilation (rebuilding the ROM) then simple test there is unbuild using whatever you are using and rebuild accordingly. Some games are a bit fussy here about what they need, though for that there are tools like nitro explorer (originally made for New Super Mario Brothers which is one of the tricky ones for older approaches like ndstool).
 
  • Like
Reactions: jeffyTheHomebrewer

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
Code:
package;

import haxe.io.Bytes;
import flash.utils.ByteArray;
import flixel.FlxState;
import flixel.FlxG;
import flixel.addons.ui.FlxUINumericStepper;
import flixel.addons.ui.FlxInputText;
import openfl.net.FileReference;
import openfl.events.Event;
import openfl.events.IOErrorEvent;

class PlayState extends FlxState
{
    var inputFile:FileReference;
    inputFile = new FileReference();

    inputFile.addEventListener(Event.COMPLETE, coolLoad);
    inputFile.addEventListener(Event.CANCEL, cancelLoad);
    inputFile.addEventListener(IOErrorEvent.IO_ERROR, errorLoad);
    inputFile.load();

    var inputArray:ByteArray;
    var inputBytes:Bytes = inputFile.ofData();


    var textNumber = new FlxUINumericStepper(10, 10, 1, 1, 1, 100);
    var curNumber = new FlxUINumericStepper(65, 10, 1, 1, 1, textNumber.value);

    var fileLength:Int = inputBytes.getInt32(0);
    var dialogueLength:Int = inputBytes.getInt32(4);
    var tableStart:Int = inputBytes.getInt32(8);
    var scriptStart:Int = inputBytes.getInt32(12);

    var lineLengths:Array<Int> = [];
    var lines:Array<String> = [];
    var startLengths:Array<Int> = [];

    for (i in 0...dialogueLength-1)
        {
            startLengths.push(inputBytes.getInt32(16 + 4*i));
            if (i < dialogueLength-1) lineLengths.push(inputBytes.getInt32(16 + 4*(i+1))-inputBytes.getInt32(16 + 4*i));
            else lineLengths.push(lines[dialogueLength-1].length-inputBytes.getInt32(16 + 4*i));
        }

    for (i in 0...dialogueLength-1)
        {
            var text:String = inputBytes.getString(scriptStart + startLengths[i], lineLengths[i], UTF8);
            lines.push(text);
        }
   
    var line = new FlxInputText(10, 65, 300, lines[curNumber-1]);

    private function coolLoad()
        {
            inputFile.removeEventListener(Event.COMPLETE, coolLoad);
            inputFile.removeEventListener(Event.CANCEL, cancelLoad);
            inputFile.removeEventListener(IOErrorEvent.IO_ERROR, errorLoad);
            inputFile = null;
            FlxG.log.notice("Loaded translation file!");
        }

    private function cancelLoad()
        {
            inputFile.removeEventListener(Event.COMPLETE, coolLoad);
            inputFile.removeEventListener(Event.CANCEL, cancelLoad);
            inputFile.removeEventListener(IOErrorEvent.IO_ERROR, errorLoad);
            inputFile = null;
        }

    private function errorLoad()
        {
            inputFile.removeEventListener(Event.COMPLETE, coolLoad);
            inputFile.removeEventListener(Event.CANCEL, cancelLoad);
            inputFile.removeEventListener(IOErrorEvent.IO_ERROR, errorLoad);
            inputFile = null;
            FlxG.log.notice("Something wrong here. Please recheck.");
        }
   
   
}

I attempted to use HaxeFlixel and I want someone to test it out, I couldn't compile it for some reason on my end so I need your help.

Currently it is being used as a viewer and not an actual creator.
 
Last edited by COR3Z,
  • Like
Reactions: jeffyTheHomebrewer

COR3Z

Member
OP
Newcomer
Joined
Apr 2, 2020
Messages
21
Trophies
0
Age
21
XP
91
Country
Indonesia
Looking into the rom, specifically the arm9.bin, I can see a lot of commands that are going to be used in the script. Expressions include "sad", "shy", "talk", then special methods were written into the code such as, *set, *add, *sub, (any string that starts with *).

upload_2021-6-27_16-49-8.png

Unpacking the script files, multiple .txt files were found. These contain the variables the text has shown.

Many variables such as "day", "month", "year", and character names were found inside the list. The ones that I did not find is how they are called in.

upload_2021-6-27_16-55-55.png


Due to my lacking coding skills I'm finding someone who could create a tool that can create variables in the arm9.bin, generator for the script text file, and english translation, I will send you the rom in the pms if necessary.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • S @ salazarcosplay:
    @BigOnYa Im not crazy about getting all of them, i feel like I have something to show for for the time put in
  • S @ salazarcosplay:
    @BigOnYa If you want to do rgh or 360 mod
  • S @ salazarcosplay:
    does it matter if you update your 360 or not before trying is it advisable or not
  • BigOnYa @ BigOnYa:
    Yea I don't pay attention to them really. Or do I try to 100% a game. I just play till story ends/ or I get the girl!
  • K3Nv2 @ K3Nv2:
    Bigonya uses his wiener to mod 360s
    +1
  • Xdqwerty @ Xdqwerty:
    Going to the water park, see ya
  • BigOnYa @ BigOnYa:
    You should update the 360 to newest dash before RGHing it yes. But not a big deal if you don't, you can install new dash/avatar updates after. It's just easier to do it auto online before, instead manual offline after.
  • BigOnYa @ BigOnYa:
    Have fun @Xdqwerty. If you see a chocolate candy bar floating in the water, don't eat it!
  • AncientBoi @ AncientBoi:
    :O:ohnoes: Y didn't U Tell ME that ALSO? @BigOnYa :ohnoes: 🤢🤮
    +1
  • BigOnYa @ BigOnYa:
    Does it taste like... chicken?
    +1
  • S @ salazarcosplay:
    @BigOnYa I wanted to ask you about your experience with seeing south park. Most of the people a bit younger like my younger brother and cousins that are a few younger than me that saw kids found south park funny because of the curse words, kids at school, that seemed like liking the show on a very basic level.

    I could not quite have a in depth discussion of the show.

    How was it for you? As an adult. What did you find the most interesting part about it. Did you relate to the parents of the kids and their situations. Was it satires, the commentary on society. The references on celebrities' and pop culture.
    +1
  • BigOnYa @ BigOnYa:
    I remember seeing the very first episode back in the day, and have watched every episode since. I used to set my VCR to record them even, shows how long ago.
  • BigOnYa @ BigOnYa:
    I just like any comedies really, and cartoons have always been a favorite of mine. Family guy, American Dad, Futurama, Cleveland Show, Simpsons - I like them all.
    +1
  • BigOnYa @ BigOnYa:
    South Park is great cause they always touch on relavent issues going on today, and make something funny out of it.
    +3
  • S @ salazarcosplay:
    @BigOnYa were you always up to date on the current events and issues of the time or were there issues that you first found out thru south park
  • BigOnYa @ BigOnYa:
    Most of the time yea I knew, I watch and read the news regularly, but sometimes the Hollywood BS stuff, like concerning actors slip by me. I don't follow most Hollywood BS (example: the Kardasians)
    +2
  • S @ salazarcosplay:
    @BigOnYa there were relevant issues before south park was made, that's why i think a south park prequel/spinoff would be great. Randy and his friends in their child hood
    +1
  • BigOnYa @ BigOnYa:
    Yea, like them running in high school together, getting into stuff, and how they got hitched and had kids. And how the town of South Park was back then compared to now. That would be cool to see.
  • BakerMan @ BakerMan:
    yeah
  • The Real Jdbye @ The Real Jdbye:
    @salazarcosplay if they made a prequel, it would still be about current issues, cause it doesn't make sense to make it about stuff that happened 30 years ago that nobody cares about anymore
  • The Real Jdbye @ The Real Jdbye:
    it's too late
  • The Real Jdbye @ The Real Jdbye:
    the older south park episodes about particular issues usually age poorly since the topic is no longer relevant
  • The Real Jdbye @ The Real Jdbye:
    an exception is giant douche vs turd sandwich, that's always relevant :P
    +1
  • K3Nv2 @ K3Nv2:
    I was gone for like an hour and none of you thought to write or call pos
    K3Nv2 @ K3Nv2: I was gone for like an hour and none of you thought to write or call pos