Register - Login
Views: 85598977
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - JCS - Stats - Latest Posts - Color Chart - Smilies
09-20-17 07:14:26 PM

Jul - Projects and Creations - DS emulator project: melonDS New poll - New thread - New reply
Pages: 1 2Next newer thread | Next older thread
StapleButter
Member
Level: 39


Posts: 251/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 05-07-16 07:24:21 PM Link | Quote
it's still in the brainstorming stage, but I feel like making it and will likely start writing code soon-ish


the idea is to do things right and fast, akin to blargSNES, and make that emulator actually somewhat accurate (did you know that desmume maps the ARM9 BIOS to 0x0FF00000 instead of 0xFFFF0000? now you know)

I also hope to emulate some things like memory protection, which would be convenient for development, but not sure how that will go

I just want to inject some novelty in an increasing stale scene -- NO$GBA is putting all effort into DSi support, desmume is pretty much dead (and I'm not a fan of their crap) and all the others are long dead



one of the things I want to implement is auto-compensation between ARM9 and ARM7, like in blargSNES (but hopefully working better), to try simulating the ARM9 and ARM7 running concurrently without completely killing performance

ie. ARM9 runs for a maximum amount of cycles (that will be determined via testing), but stops before that if it starts waiting for an IRQ or if uses IPC to talk to the ARM7

then the ARM7 catches up to the ARM9, and so on

with the DS, a convenient thing is that both CPUs run off the same base clock (33/66), unlike the CPU/SPC in the SNES



who knows, maybe I'll get far enough to get into the wifi crap again



if you have any ideas or remarks, feel free to go on
Cuber456

Melon Bug
Don't mind me. Just passing through.
Level: 50


Posts: 660/745
EXP: 918570
For next: 28747

Since: 02-19-12
From: Everywhere at once.

Since last post: 34 days
Last activity: 2 hours

Posted on 05-07-16 08:13:25 PM Link | Quote
Any particular reason why you chose the name melonDS?

I guess the only other remark is that I have always wondered how one just starts coding up an emulator. I mean, where does one even start?
StapleButter
Member
Level: 39


Posts: 252/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 05-07-16 08:16:33 PM Link | Quote
why not?

time has shown that I suck at names, anyway, so enjoy that amazing name that for once isn't blarg-based


as for how to code an emulator, well

I'd say you have to figure out the machine's memory layout and where your game/program/whatever will go

once you have loaded it, you start executing it, which implies emulating whatever processors the machine has

then you emulate the hardware that is connected to these processors, and keep going until things work
Starroad32

Level: 5


Posts: 6/7
EXP: 377
For next: 152

Since: 08-01-16
From: Look at my avatar ^_^

Since last post: 1.0 years
Last activity: 1.0 years

Posted on 08-02-16 01:41:34 AM Link | Quote
Huh, I just read the DeSmuME thread and that must feel pretty harsh. Your work being put in and then all for nothing.

Hope you get freedom with your own thing with this project. "melonDS" is a rather simple but catchy name, too.
MooMilk
User
Level: 9


Posts: 5/24
EXP: 2405
For next: 757

Since: 07-29-16


Since last post: 66 days
Last activity: 3 days

Posted on 08-02-16 05:21:22 AM Link | Quote
It's either accuracy or a emulator that can be included in those emulator compilations. I don't know if there's a DS emulator for those emulator compilation but I don't think accuracy is taken yet. Sad that DS never runs good on any of my pc's. The castlevania games always run ok cause they're 2d, and those are the ones most important to me I think. Still, would be nice to play 3d games cause you never know when a interesting proto could pop up. I remember being disapointed cause I couldn't run Gauntlet.
StapleButter
Member
Level: 39


Posts: 319/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 08-10-16 08:38:40 PM (last edited by StapleButter at 08-10-16 08:44:44 PM) Link | Quote
the melonDS project went on a major halt, changes and shitsplosions in my life and something else (can't tell more).


anyway, might get this somewhere. dunno.


also re: ARM9/ARM7 sync

there are two ways the two can communicate: using the IPC registers (preferred) and accessing specific memory addresses (crapo. generally used to transfer a data structure while IPC is used to signal the other CPU that new data is ready).

for a game that does IPC sync properly (and most commercial games will, due to using the same SDK), it's easy, we just have to detect accesses to the IPC regs.

for memory-based access, on the ARM9 side, we can hook the CP15 cache control commands. ARM9 code has to invalidate the cache before reading an IPC structure, and flush the cache after writing to it. Or alternately, access the memory from an uncached mirror. Both can be detectd.

on the ARM7 side, there's... nothing. ARM7 side doesn't really matter though-- the design would basically make the ARM9 the master processor, and have the ARM7 catch up when needed. The ARM7 can't run ahead of the ARM9 in that setup.
StapleButter
Member
Level: 39


Posts: 390/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 12-23-16 03:16:19 PM Link | Quote
seems it's bump season, so...


melonDS is finally getting somewhere.

current status:

runs a good part of the ARMWrestler tests, all those that are implemented are okay
runs the BIOS/firmware, up to a point
gets stuck somewhere in said BIOS/firmware boot process

the issue is... really weird. the firmware sets up a timer with IRQ, but the interval is so tiny that it doesn't have time to do anything other than repeatedly processing timer IRQs, effectively getting stuck.
Joe
Common spammer
🗿
Level: 103


Posts: 3267/3286
EXP: 11462100
For next: 9306

Since: 08-02-07
From: Pororoca

Since last post: 46 days
Last activity: 1 day

Posted on 12-24-16 06:58:53 PM Link | Quote
I don't know if this is applicable to ARM, but I know on x86 most things that enable interrupts (e.g. returning from an interrupt) actually delay enabling interrupts for one instruction, so the main thread can make progress even if it's flooded with interrupts.
StapleButter
Member
Level: 39


Posts: 397/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 12-29-16 11:03:02 PM Link | Quote
I thought about that too. I ran a quick test on my DS, but the results say otherwise-- constant IRQ flood really does halt the main code flow. Unless I did the test wrong.
StapleButter
Member
Level: 39


Posts: 403/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 01-17-17 11:24:39 AM Link | Quote
So I recently found out why the firmware was doing that weird shit.

There's a function that configures timer 1, it first disables the timer, then calculates the delay in some way, writes it and reenables the timer.

I logged writes to the timer 1 control register and where they happened. That showed that it repeatedly enabled the timer, but without disabling it prior, which wasn't possible if the aforementioned function was called normally. Which meant that it was entering the function accidentally.

It came from the firmware's IRQ handler. Said handler does weird magic, switching between CPU modes, saving and restoring shit manually... At some point, it pulls a SPSR and return address from somewhere and uses the normal 'return from interrupt' instruction to jump there. The SPSR is written to the CPSR, and thus determines, among other things, whether the code it jumps to will be ARM or THUMB.

GBAtek says about the MSR/MRS opcodes that the THUMB bit can't be changed, but that only applies to the CPSR. Infact, the firmware relies on that bit being changed properly when writing to the SPSR.

So in the end, I would set the THUMB bit wrong, causing code to be run in the wrong mode.

Positive side is that now the firmware seems to be running okay, and even getting far enough to set up graphics.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 76/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 49 days
Last activity: 22 days

Posted on 01-25-17 12:38:18 AM Link | Quote
There any plans for debugging / hacking / ripping&dumping types of features?

Just curious, obviously getting the thing to WORK is more of a priority right now.
StapleButter
Member
Level: 39


Posts: 407/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 02-02-17 07:54:24 PM Link | Quote
Who knows!


For now, well, I'm at a point where I need to decide what to do next. Save support would be nice to have, right now it's hardcoded for 64k EEPROM and requires an existing savefile.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 88/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 49 days
Last activity: 22 days

Posted on 02-02-17 08:31:31 PM Link | Quote
Saving is definitely a good idea.
Will that include save states? (or have them added sometime in the future?)

Anyways, good luck.
I'll definitely be watching this closely.
I personally don't have *too* many issues with Desmume, but I agree it's overdue for an update.
I'm also very much not impressed with that thread you linked, I'm sorry you had to go through that.
If there were a reliable alternative, it might make me drop Desmume cold-turkey.
StapleButter
Member
Level: 39


Posts: 408/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 02-07-17 03:30:30 PM Link | Quote
savestates may come, but later. wouldn't be a good idea right now as I'd keep making older savestates incompatible by adding new shit


anyway, thanks!

melonDS can run some games, somewhat. I post progress here as well as occasional tech notes.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 91/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 49 days
Last activity: 22 days

Posted on 02-08-17 01:47:31 AM Link | Quote
I know that feeling. "I won't add/consider this yet cuz it'll break everything that came before it"

np!

For my tastes, it'd have to support everything I've actually bothered to get a ROM for, although the ideal emulator would support every game...XD (gl with that, I hear that manages to be difficult)

Some specifics:
Bionicle Heroes
Solatorobo: Red the Hunter (IDK if you've dealt with this topic yet, but I'm pretty sure this has vertex lighting/shading, or whatever it's called... I noticed certain colors were applied when previewing the NDS-formatted model that the exported .obj doesn't seem to have)
Lego Battles
Lego Battles: Ninjago

There are others, but these are the only ones I could see myself actually trying to finish for now.

Honestly, you lost me on on that technical talk. I just don't understand low-level computing nearly well enough yet.

Well, like I said, I wish you luck, and I'll keep an eye on everything. I don't really have much else to say right now.
RanAS
Member
Level: 29


Posts: 237/272
EXP: 147169
For next: 716

Since: 10-10-14
From: Brazil

Since last post: 8 days
Last activity: 4 days

Posted on 02-09-17 07:37:35 AM Link | Quote
I saw you wanted to use Qt for the UI and I just wanted to share a recent experience.

A while ago my father wanted to mess with the Qt interface for his mini-program and said if I could mess with the code a bit with him, with a bit of trial and error we got the UI working fine so that's not an issue, but I must say the most difficult part of Qt for both of us was trying to get it to communicate with the C++ code (which worked well by itself using just the console) and getting the C++ to receive values from the Qt interface, it seems like to call a C++ function you'd need to program a CONNECT signal to a Qt OBJECT, and you need to define the function in which you want to call in that object in ways we didn't really bother to do. Plus, trying to make the C++ code access the interface back was also a pain because we couldn't make it access MainWindow->(gridLayout?)->QLabel->value without it answering "x doesn't exist" (what?).

So that could be an issue. Then again, it could be just us being total derps, that too. Either way, maybe it's not a good idea to use Qt, just sayin'.

That said, I'm incredibly impressed by the progress melonDS is having and I hope the best for this emulator, my father has always complained about using the "computer frying emulator" (DeSmuME) when I tried to play SM64DS on his laptop.
brian151
Banned
The administration (as well as a few users) have decided that you're creepy/weird enough that it's time to activate the sploded clause.
Laters.


Level: NaN


Posts: 107/-249
EXP: NaN
For next: 0

Since: 08-09-16
From: USA

Since last post: 49 days
Last activity: 22 days

Posted on 02-20-17 05:11:39 PM Link | Quote
Originally posted by ihadtnowegtum
...Solatorobo: Red the Hunter (IDK if you've dealt with this topic yet, but I'm pretty sure this has vertex lighting/shading, or whatever it's called... I noticed certain colors were applied when previewing the NDS-formatted model that the exported .obj doesn't seem to have)...



Alright, I think a more standard term is "vertex colors"
Anyways, games like Solatorobo won't look nearly as good without them, because they're used fairly extensively, from what I can tell.
StapleButter
Member
Level: 39


Posts: 411/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 03-04-17 01:35:12 PM Link | Quote
oh hey hey hey





the road painting employees in Mushroom Kingdom are drunk


more seriously, I think this is caused by not properly perspective-correcting the texcoords along Y. I calculate the left/right side W by simply interpolating, but maybe I should do perspective-correct interpolation there.


anyway, current status of melonDS:

* runs games with a nice compatibility rate
* slower than desmume, but hasn't been optimized yet
* 3D renderer is slow. ideas include: putting it on a separate thread, providing a hardware renderer
* vertex colors aren't properly blended in. I need to add support for lighting before that's possible.
StapleButter
Member
Level: 39


Posts: 412/459
EXP: 401751
For next: 3020

Since: 02-24-13
From: your dreams

Since last post: 15 days
Last activity: 7 days

Posted on 03-29-17 10:53:39 PM Link | Quote
hey hey hey


It's out!
Sanqui
1560
🦉
Level: 72


Posts: 1497/1568
EXP: 3303929
For next: 19833

Since: 12-20-09
From: Czech Republic

Since last post: 18 days
Last activity: 1 day

Posted on 03-30-17 03:17:42 AM (last edited by Sanqui at 03-30-17 03:21:38 AM) Link | Quote
Looks amazing!

Do you plan on putting the source out?

EDIT: Lookie I found it myself! https://github.com/StapleButter/melonDS
Pages: 1 2Next newer thread | Next older thread
Jul - Projects and Creations - DS emulator project: melonDS New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 2f1bc75 [2017-08-27]
©2000-2017 Acmlm, Xkeeper, Inuyasha, et al.

30 database queries, 9 query cache hits.
Query execution time: 0.184839 seconds
Script execution time: 0.019993 seconds
Total render time: 0.204832 seconds