![]() |
Extensible GBA Emulator
As a GBA hacker, an emulator is one of our fundamental tools. Although the options we have are stable, there is no all-in-one solution. You have to resort to an SDL port of VBA to debug ASM, for example. However, there is no reason to think that an emulator can't be extended like any other tool.
However, VBA-M's source (and VBA's source before it) is cluttered and unwieldy. It is difficult at best to write your own port. Thus, I've written my own generic port, and exposed a C interface for you to use. This will allow custom ports to be readily created. One caveat however: You cannot run multiple instances in the same process. The source is too cluttered with global variables to refactor satisfactorily. If you want to get around this, load up the shared library in another process. The source can be cloned from the GitHub repository: Code:
|
Why is it based on a version of VBA-M thats 3 years old? You should use the latest svn.
|
Quote:
UPDATE: I've disabled GBA Link (there's no real use for it?) functionality, thereby removing the SFML dependency. I will update the source to the latest SVN. This issue can be worked out later. |
I would personally find this very useful, as VBA-SDL-H can get pretty finicky when it comes to working at multiple computers; usually changing out the SDL.dll will fix it but not always. It would also be nice to see a GUI instead of the usual CMD window.
|
I'll work on building it on Windows. (:
|
Quote:
Quote:
I used Python 3.4 to compile this. You'll have to change the required includes and libraries in CMakeLists.txt manually. The find package function doesn't seem to work for Python 3. You'll also need zlib, libpng, OpenGL and SDL development libraries. Don't bother with the GTK+ port. It includes far less than the SDL version, and Windows's GTK+ support is lacklustre anyway. |
Quote:
|
Quote:
Apologies if this is a stupid question, I am just starting my journey into programming. With a system like this, would it be possible to make hack specific plugins? For example, a bigger better Pokémon PC storage, saved in some file on your computer that the game accesses instead of the normal method? Would that be possible to hijack certain game routines like that to give bigger ram etc? Kind of like a gba emulator that extends games into the pc realm. |
Quote:
Quote:
To be honest, I didn't really envision anything like that. I thought it could be used to debug script routines (with breakpoints and stepping) and other functions for testing/debugging purposes (Warp to a specific map, etc.). But, theoretically, you could add any functionality through Python. As long as someone adds the correct C code for it. |
CMake can generate you .sln files super easily, just select the target (MS12 if VS2013, etc) and there shouldn't be any problem. It'd probably be cool if you put this somewhere on GitHub, Bitbucker or any of your preffered CVS :p
Haven't tried it yet (my real work device is dead, i'll need time to get a new one), but this sure sounds great! |
Quote:
|
Cool, I just lost all I wrote.
Summing it up: - Adding execution and memory breakpoints, with conditions, would be very nice. - Also mimic VS's Watches (auto updates value in a memory address, convenient instead of having to "m(h|b|d) offset" in VBA SDL H) About CMake: I'm not a CMake guru, but by the looks of it (for old cmake versions), FindPythonModule will only look for Python up to 2.7. Try "find_package(PythonLibs EXACT REQUIRED 3.0)" or "find_package(PythonLibs REQUIRED 3.0)" (EXACT just makes it so that _only_ 3.0 is picked; not above). cmake.org/Bug/print_bug_page.php?bug_id=13794 also, VS solution files are not .SIN, but SLN :p [EDIT] You might want to update to latest Cmake: cmake.org/cmake/help/v3.0/module/FindPythonLibs.html github.com/Kitware/CMake/blob/master/Modules/FindPythonLibs.cmake You can also enforce any version of cmake in your CMake scripts by calling "cmake_minimum_required(VERSION 2.8.9)" in the main CMakeLists.txt of your project. Also, protip: the URL parser looks for "http (s) : / / (w w w)", so strip them out :p |
Quote:
I thought I could bypass the parser (it's probably just a basic URL Regex), but I thought any post doing so would just be removed. I guess that that rule isn't strictly enforced then? |
I think it's just a limitation for scamming bots. Hopefully mods don't get back on me D:
|
GBA-link is very usesful...
|
Quote:
Quote:
UPDATE: I've added a link to the GitHub repo. |
Yes, thanks (I use it to put events, make trades, use E-Reader on a game).
It can be useful :) |
Currently, when you start the emulator, it looks for a file in the current directory called vba.py. It loads this file, and calls the load() function inside it. This will form the plug-in loader after the API is complete. Right now, the API consists of several MemoryView buffers, allowing read/write access to the various GBA memory blocks, as well as the CPU and IO registers. Additionally, I've provided read-only access to the BIOS and ROM memory blocks. This already adds quite a lot of functionality. I plan to add other features to make this API contain various other plug-in features, such as event listeners (JQuery style) and hooks (WordPress style). Additionally, I plan to create Python versions of most of the standard emulator functions (Loading and resetting ROMS, automated patching, graphics filters, debugging, etc.)
I've also thought of another fairly cool idea. Using the "API" as it currently stands, one could create a plug-in that writes a particular byte sequence to a free area in the GBA RAM on start up. It could then ensure that this sequence is not over-wrriten, allowing someone to check whether this emulator is being used in-game (from a script or assembly routine or something). This could (possibly) open up avenues for extra features in scripts: we could see what plug-ins are loaded or whatever. Any input from C/C++ or Python programmers would be greatly appreciated. What would you like to see in the API? If you wish to contribute, you can just send me a pull request. |
What I would do, personally speaking, would be to write the main code in C and adapt it so that it can be compiled to an DLL. Then write a library to access the library from Python, and control it that way. Also, I haven't had time to try building the program again, and I might not for a little bit.
|
Quote:
|
Plus if everything needs to be compiled, that cuts off a certain amount of freedom for the user I would say. Scripts on the other hand could easily be tweaked to individual needs and improved by many.
|
Quote:
|
Quote:
|
In an attempt to acquiesce to requests here, I've create a C++ library which will form the back-end of the new Python-based emulator. This library contains all the core functions necessary to implement your own emulator, in whatever language you desire (as long as you write the appropriate bindings). I shall attempt to make the code as minimal and as fully functional as possible. Write now, a number of (critical) things do not work properly. I've disabled save states, because I'd like to make them saved to the RAM, rather than a file on the disk. This will be to allow you to decide what you want to do with the file. However, I've modified the processor core to allow for better debugging features. You can now set read/write breakpoints on any address you desire. Anyway, this is basically just a taster. I'll commit more changes soon. Now that I've forked VBA-M's source, I'll be free to edit as much of the source as I please - this is what was slowing my progress down before.
The source can be found on my GitHub repository. I'll update the main post with a link, and hopefully with a sample application. Otherwise, you can look at the test application in the source. It doesn't do much, but it's a proof of concept. |
Quote:
Also, you talk about the SDL version of VBA like it's a bad thing. |
| All times are GMT -8. The time now is 8:50 AM. |
![]()
© 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.
Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.