Banner
Views: 943,582,399
Time:
5 users online: Aja, Azula16, OEO6, Souldbminer, TheLegendaryOrb - Guests: 62 - Bots: 80 Users: 52,468 (1,990 active)
Latest: Jigsaw69
Tip: The first column of the palettes list is the transparency. Don't edit it, as it won't do anything.
Not logged in.
Bowser64 - SM64 Memory Editor
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - ASM & Data Repository - Bowser64 - SM64 Memory Editor
Pages: « 1 2 » Link
Would you be able to explain how you determine the VM rom base from each emulator? I'm trying to create a program that hooks into an emulator, and the only way I can get it to work on other people's computers is by figuring out their emulator's VM base address, since it differs from computer to computer. I know you don't have the source code, but if somebody could explain how that sort of thing is done, I would appreciate it greatly.

--------------------
Captain Swag, creator of Mario 64 Movie Maker 2.0, maintainer of LazyShell 4.0, and a bunch of other stuff.
The process can differ a bit from emulator to emulator.

Some have constant bases:
Nemu = 0x10020000
1964 = 0x20000000
(I think Daedalus has one too but I can't remember it)

Others' virtual ram are allocated dynamically meaning you'll either have to make your program scan for the location of your game's ram header data (sort of a noob solution but that's what I made bowser64 do and it works to some extent), or do a bit of reverse engineering and find set of pointers/offsets which always point to the emulator's virtual ram.

If you're already acquainted with windows' readprocessmemory function to some degree and you're gonna do this vm base thing by scanning, I recommend loading 2048 bytes in a buffer at a time then loop through your buffer and compare integer values.

Would probably look something like this in C if I remember correctly:

Code
unsigned int scan4int(int number){
  int chunksize = 2048;
  void * comparison_buffer = malloc(chunksize);
  int numberofbytesread;
  unsigned int i;
  for(i = 0; i < 0x80000000; i += chunksize){
    ReadProcessMemory(emulator_handle, (void*)i, comparison_buffer, 2048, &numberofbytesread;);
    unsigned int j;
    for(j = 0; j < chunksize; j += sizeof(int)){
      if(*(unsigned int*)(comparison_buffer + j) == number){
        free(comparison_buffer);
        return i + j;
      }
    }
  }
  free(comparison_buffer); // wasn't found
  return -1;
}


Then for sm64:
Code
int vmbase = scan4int(0x3C1A8032);


Endianess on the comparison buffer might need to get swapped after each load, but I'm not sure. Been a while since I've done this sort of thing #smw{@_@}


This is the best post
I scanned the proccess memory as well, and in Projext64's case, it seems like the emulated memory base always starts at an address ending in 0000, so I only searched by bytes with those endings in my program.

--------------------
Captain Swag, creator of Mario 64 Movie Maker 2.0, maintainer of LazyShell 4.0, and a bunch of other stuff.
This program looks great. This is something that would be useful for me. Great job.
Will this ever be continued?

--------------------
h is a cool letter
Pages: « 1 2 » Link
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - ASM & Data Repository - Bowser64 - SM64 Memory Editor

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2021 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks