Skip to content

feat(vm): add jit support#5

Open
leap0x7b wants to merge 2 commits intoMrPowerGamerBR:mainfrom
leap0x7b:jit
Open

feat(vm): add jit support#5
leap0x7b wants to merge 2 commits intoMrPowerGamerBR:mainfrom
leap0x7b:jit

Conversation

@leap0x7b
Copy link
Copy Markdown

Adds basic JIT support to the VM using sljit, which should theoretically improves performance on some platforms. Works fine on Linux/GLFW and haven't encountered any noticeable problems so far. Couldn't test on PS2 since I can't figure out how to make an ISO for it though since sljit has support for MIPS, it did compile without any problems.

@MrPowerGamerBR
Copy link
Copy Markdown
Owner

MrPowerGamerBR commented Mar 22, 2026

If you want to build the PlayStation 2 ISO, what I recommend doing is this:

  1. Build the Butterscotch ELF file with this Instructions to compile newest code for ps2? #3
  2. Generate the preprocessed files with https://butterscotch.mrpowergamerbr.com/
  3. Create a new folder, put ALL the files from the generated ISO in there
  4. Delete the BUTR_000.00 from the original ISO
  5. Copy your Butterscotch ELF to the folder and rename it to BUTR_000.00
  6. Create a new ISO with mkisofs -o Butterscotch.iso -V "UNDERTALE" -sysid "PLAYSTATION" -no-pad -D -l PathToTheISO/

In the future I do plan to open source the preprocessor tool itself (it has a Kotlin/JS version (which is the one hosted on Butterscotch's website) AND it also has a Kotlin/JVM CLI version)

@MrPowerGamerBR MrPowerGamerBR force-pushed the main branch 2 times, most recently from e798041 to 22633e5 Compare March 25, 2026 02:51
@leap0x7b
Copy link
Copy Markdown
Author

The JIT seems to work on PCSX2. I couldn't really confirm since it's running on an emulator on my slow and aging laptop though Undertale did perform slightly better with JIT and runs at slightly more consistent 30fps. I did encounter some crashes during the Asriel battle though I don't know if it's because of my JIT code or something else and if those crashes also happen on non-JIT as well.

I don't have a real PS2 so it would be really appreciated if someone who has one tested my changes. My neighbor has one though I don't think they would be willing to borrow or give it to me. I have enough money on my wallet to buy a PS2 on an online marketplace though I was saving for a new laptop so I'm not sure if I should buy it or not (+ my parents are very strict so I don't even know if they will even approve of my purchases)

@MrPowerGamerBR
Copy link
Copy Markdown
Owner

I've tested it on PCSX2 with the latest Butterscotch version + SURVEY_PROGRAM's Jevil fight, but it seems that for some reason it did not provide any meaningful differences (before it was running at 4 FPS, after it was... still running at 4 FPS)

I wonder if something is going wrong for it to not be working

@MrPowerGamerBR MrPowerGamerBR force-pushed the main branch 2 times, most recently from d9ca0fa to 57c6fa7 Compare April 17, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants