Comments (6)
I see. I'm ok with that.
from binjgb.
It's a bit weird I suppose, but the way it currently works is that the ROM data ownership is passed to the emulator. Are you using this in some way where you want to retain ownership of the ROM data after the emulator is destroyed?
from binjgb.
The application layer is written in C++. The emulator per se and the ROM are both retained by a wrapper class. In particular the ROM data is created and owned as a member field like std::shared_ptr<Bytes> rom = std::shared_ptr<Bytes>(new Bytes(...))
. They will be both unused and released at a same time; so the problem is not a ROM lives longer than an emulator instance, it is just I hope that ROM is released consistently with it's creating.
from binjgb.
Unfortunately that's not a valid strategy with the most recent changes, since the emulator may resize the rom data (see e.g.
Line 1196 in 1e67a75
emulator_new()
that ownership of the ROM data has been passed to Emulator
.from binjgb.
Ok. Then I think it's better if there were another initialization workflow that duplicates input ROM data inside emulator. In short, an emulator who is in charge of freeing should be also in charge of allocating the space for ROM data.
from binjgb.
At least for the ways I use emulator_new()
, it works best to pass ownership. The calling code has no need for the ROM data after it's been loaded. And similarly, it doesn't make sense for the emulator itself to allocate the space since it doesn't know how much it will need; the ROM data could be coming from a file on disk, or generated automatically in memory, or anywhere else.
If you want your calling code to retain ownership the best way is to make a copy yourself to give to the emulator, rather than having an additional option in EmulatorInit
to do this.
from binjgb.
Related Issues (20)
- Lost Save Files HOT 9
- Run Boot Rom HOT 2
- Joypad interrupt does not fire HOT 2
- Scaling is uneven HOT 2
- Vsync bug HOT 1
- Read sym file HOT 1
- Implement debug messages HOT 1
- Feature request: add a .sav import/export feature HOT 4
- Scanlines with the BG/Window disabled don't clear old sprite pixels HOT 2
- having trouble with embedding HOT 2
- Rejects ROMs as invalid HOT 4
- Skip audio frames while audio context is suspended HOT 2
- Huge RAM usage. HOT 5
- Integrate changes from daid/binjgb HOT 1
- Fatass Tracker doesn't work HOT 4
- Cube Raider doesn't work as expected HOT 3
- OAM priority calculation HOT 1
- Bf em
- Bijna
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binjgb.