suXinjke / cruncheevos

Set of tools to deal with RetroAchievements achievement sets using JavaScript
MIT License
2 stars 0 forks source link

Add Code Notes when using generate command #1

Open Kinglink opened 3 months ago

Kinglink commented 3 months ago

cruncheevos should have a "Generate code notes" function. The Code notes should be made into simple elements in the JS script. They would look something like

/* 
(Array of 44 8-bit numbers).  Win Loss of CURRENT car in Arcade

0x00 = Unbeaten
0x01 = Beaten in Dry. 
Any number is Beaten in Rain, continues to increments. 

- Myogi Start
0x00=Itsuki Takeuchi
0x02=Takumi Fujiwara
0x04=Shingo Shouji
0x06=Takeshi Nakazato
- Usui Start
0x08=Two People From Tokyo
0x0a=Nobuhiko Akiyama
0x0c=Mako Satou & Sayuki
0x0e=Tsukamoto
- Akagi Start
0x10=Kyouko Iwase
0x12=Kenta Nakamura
0x14=Keisuke Takahashi
0x16=Ryosuke Takahashi
- Akina Start
0x18=Kenji
0x1a=Iketani Kouichirou
0x1c=Wataru Akiyama
0x1e=Takumi Fujiwara
- Happougahara Start
0x20=Tooru Suetsugu
0x22=Daiki Ninomiya
0x24=Sakai
0x26=Tomoyuki Tachi
- Irouhazaka Start
0x28=Seiji Iwaki
0x2a=Kyouichi Sudou
0x2c=Kai Kogashiwa
0x2e=Keisuke Takahashi
0x30=Takumi Fujiwara Final
0x32=Bunta Akina (Out of line)
- Real Myogi Start
0x34=Shingo
0x36=Nakazato
- Real Usui Start
0x38=Mako Satou & Sayuki
- Shomaru Start
0x3a=Wataru
- Momiji Line Start
0x3c=Toru
0x3e=Atsure
- Enna Skyline Start
0x40=Daiki
0x42=Smiley Sakai
*/
let memory327950 = 0x00327950

Basically take the entire text of the code note and put it in the file, follow it with a simple variable with a memory address. Then as a programmer, I can come along and rename that memory variable as I want, but also have the documentation for that value right there.

This is especially helpful because transcription of these values can lead to errors and incorrect memory/documentation which could cause issue.

This doesn't have to be a major feature just a way to press a button after making all the code notes, and then from there allow the user to only need to use the JS file to generate their achievements, rather than having to refer to the game/code notes in another manner.

(object and comments can be done in the TS or JS style format you prefer, just used a simple version)

suXinjke commented 3 months ago

The example does match how I'd imagine it. I also would like to be able to optionally produce something like

const addresses = {
  _CAFE: 0xCAFE,
  _FEED: 0xFEED  
}

so it can be used same way as in the multi-regional recipe

in case of your example I would likely emit

-- let memory327950 = 0x00327950
++ const addr_327950 = 0x327950

Without this feature one can focus on moving out repeated blocks into functions and do Find-and-Replace after. Also if some address is required only once - ain't big deal to have it reside inside a function returning conditions, you could just give names to individual conditions and those names would imply the address is relevant to that.