@foone@digipres.club avatar

foone

@foone@digipres.club

Hardware / software necromancer, collector of Weird Stuff, maker of Death Generators. (she/they🏳️‍⚧️)

This profile is from a federated server and may be incomplete. Browse more on the original instance.

foone, to random
@foone@digipres.club avatar

I wonder how hard it would be to hack into existence a "clipboard stack".
So like, you could copy A, B, C, then when you hit paste, it would paste C, B, then A.

foone,
@foone@digipres.club avatar

might be more useful as a FIFO

foone, to random
@foone@digipres.club avatar

bad news: after extensive digging into how Wheel of Fortune (2010, Wii) loads resource files, it seems that there's no way to get it to load patch files from the memory card.

It seems to only look for them on the DVD

foone,
@foone@digipres.club avatar

I may have figured out why function parameters sometimes get elided:

I think it is ignoring const pointers.

foone,
@foone@digipres.club avatar

yeah that seems reasonable

foone,
@foone@digipres.club avatar

line 1038 of E:\Build\WheelJeopardy\Parser/PVMachine.cpp somehow declares two pointers named op0 and op1, which is fine, except the debug info says they are both stored in r27. At the same time.

how.

foone,
@foone@digipres.club avatar

there are only two major problems in reverse engineering:

  1. not enough data
  2. too much data
foone,
@foone@digipres.club avatar

guess I just have to write a log parser for dolphin to extract out execution traces from multiple megabytes of logs. this is a reasonable thing to do

foone,
@foone@digipres.club avatar

artists depiction of a programmer trying to instrument tracing into the game's virtual machine

foone,
@foone@digipres.club avatar

I ran the game for 10 seconds. 4 seconds of blank screen, 6 seconds of the "make sure you put on the Wii Strap" screen.

78 megabytes of logs as it executed 233,615 instructions in the VM

foone,
@foone@digipres.club avatar

NOPE! found a function with a const char* and it's included.

whatta hell

foone,
@foone@digipres.club avatar

they all are "pop the top value off the VM stack and static-cast it to a different pointer".

And since types are mostly a compile-time thing, the contents of these functions end up being exactly the same. Every function is effectively just returning a void*, but the compiler enforces using them differently

foone,
@foone@digipres.club avatar

OH IT'S GOT BASTARD CACHING

it loads the script, creates a VM for it, then does it again. This time it doesn't need to load the script, because it's already loaded, but it DOES create a new VM. So the second VM never had the script loaded, it just grabbed it from the cache. Then it runs on the second VM

foone,
@foone@digipres.club avatar

and it's not like parameter 4 goes unused. It's clearly used in the function, I can see it used.

SO WHY DIDN'T YOU TELL ME WHAT IT WAS CALLED?

foone,
@foone@digipres.club avatar

I'm gonna have to reverse engineer codewarrior next and see if there's any rand() calls in it

foone,
@foone@digipres.club avatar

this is how some versions of new[] work in C++. but that's a compiler, not A GAME OF WHEEL OF FORTUNE FOR THE FUCKING WII

foone,
@foone@digipres.club avatar

I've got to dump a stack in a "language" that's not turing complete and has no loops.

this'll be fun

foone,
@foone@digipres.club avatar

you've heard of the Single Instruction Computer? Well make way for the Single Register Computer!
Everything is stored in R27

foone,
@foone@digipres.club avatar

I will never understand how and why CodeWarrior debugs the arguments to functions the way it does.
It'll be all:
This is a function!
It's called Foobar!
It has 5 parameters!
Parameter 1 is an int named nSlots!
Parameter 2 is a char* named szScript!
Parameter 3 is a bool named bReload!
Parameter 5 is a PVariable* named pv!

foone,
@foone@digipres.club avatar

but it calls a different function with the same arguments, and the const char* is elided from THAT one.

foone,
@foone@digipres.club avatar

so there's 25 functions here which have the exact same bytes in their body. You'd think this would be a prime candidate for link-time function-merging but I suspect there's a C++ standard reason why they can't do that:

the pointer to two different functions should probably be different

foone,
@foone@digipres.club avatar

I can find event A: a new VM is created
event B: a script is loaded into the VM
event C: a script is executed on the VM

except while the VM pointers for A and C match, they don't at all match B. I'm apparently loading scripts into VMs that were never created. and never loading scripts into VMs that I'm executing

foone,
@foone@digipres.club avatar

BUT NO, THE PROGRAMMERS HAD TO BE CLEVER

foone,
@foone@digipres.club avatar

no it's mostly got "foone forgot the difference between a pointer and a value" bastards.
Fixed. Next, the stack. Oh god, the stack.

foone,
@foone@digipres.club avatar

this is C++. they could have just defined their stack as a class with two members, a size and an array.

or, you know, just used an appropriate STL template

foone,
@foone@digipres.club avatar

never underestimate the power of loop unrolling and pointless logging

foone,
@foone@digipres.club avatar

and that's with only one VM! This game supports multiple concurrent VMs executing at once, because of course it does.

and who doesn't want to debug concurrent C++ implemented by a bunch of game developers for a licensed tie-in-game?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • cubers
  • DreamBathrooms
  • InstantRegret
  • tacticalgear
  • magazineikmin
  • Youngstown
  • thenastyranch
  • mdbf
  • slotface
  • rosin
  • modclub
  • kavyap
  • ethstaker
  • provamag3
  • osvaldo12
  • khanakhh
  • cisconetworking
  • Durango
  • everett
  • ngwrru68w68
  • Leos
  • normalnudes
  • GTA5RPClips
  • tester
  • megavids
  • anitta
  • lostlight
  • All magazines