Homebrew [Preview] Z26 3DS - Atari 2600 Emulator

  • Thread starter Thread starter nop90
  • Start date Start date
  • Views Views 47,684
  • Replies Replies 83
  • Likes Likes 25
There's not Sudokuhax for 9.3 and above.
Well, it can work on 10.1 if you installed it previously before updating :p

But it can also run on reg DS flashcards as well albeit slower.
That doesn't help you I know but it can be a good alternative for some people.
 
Well, it can work on 10.1 if you installed it previously before updating :p

But it can also run on reg DS flashcards as well albeit slower.
That doesn't help you I know but it can be a good alternative for some people.
Yeah, is good to have alternatives for the few people who can use it.
 
  • Like
Reactions: zoogie
Maybe next month I could try to port srellaDs if no one else does it.

But now I have to learn to use the Gpu. Sorry
 
Almost ready for a full alpha release with sound. But now I need to test the FPS limiter on a n3ds.

Please check how the attached build works and give me some feedbacks.

For o3ds users, no speed improvement, but you can select a frameskip value to gain some FPS. but remember to turn off the FPS limiter or you'll not have any benefit from frameskip (the code is not optimized for frameskip). Using frameskip can result in missing sprites, but a low odd frameskip can mitigate this problem.

Changes: Now you can resume a paused game (with the menu option or exiting from menu with B). To select menu options press and release the A button quickly, or you'll select the next option too (tryed to fix this, but had no success). To decrease a value in menu use th Y button.
 

Attachments

Thanks, will give it a test. Am not actually familiar with 2600 games, but I guess I'll still be able to tell how well the limiter's working.
The menu A button thing should be fixable, post the code if you're stuck?
 
Almost ready for a full alpha release with sound. But now I need to test the FPS limiter on a n3ds.

Please check how the attached build works and give me some feedbacks.

For o3ds users, no speed improvement, but you can select a frameskip value to gain some FPS. but remember to turn off the FPS limiter or you'll not have any benefit from frameskip (the code is not optimized for frameskip). Using frameskip can result in missing sprites, but a low odd frameskip can mitigate this problem.

Changes: Now you can resume a paused game (with the menu option or exiting from menu with B). To select menu options press and release the A button quickly, or you'll select the next option too (tryed to fix this, but had no success). To decrease a value in menu use th Y button.
Almost ready for a full alpha release with sound. But now I need to test the FPS limiter on a n3ds.

Please check how the attached build works and give me some feedbacks.

For o3ds users, no speed improvement, but you can select a frameskip value to gain some FPS. but remember to turn off the FPS limiter or you'll not have any benefit from frameskip (the code is not optimized for frameskip). Using frameskip can result in missing sprites, but a low odd frameskip can mitigate this problem.

Changes: Now you can resume a paused game (with the menu option or exiting from menu with B). To select menu options press and release the A button quickly, or you'll select the next option too (tryed to fix this, but had no success). To decrease a value in menu use th Y button.

Hmm there is no sound in this on n3ds??? Am I the only one experiencing this?

Opps never mind XD
 
Last edited by NuikopeaDemon,
Thanks, will give it a test. Am not actually familiar with 2600 games, but I guess I'll still be able to tell how well the limiter's working.
The menu A button thing should be fixable, post the code if you're stuck?

The code is on my github. Yes it fixable, but I'm doing it quick and dirty trying to replace things lost removing SDL code. Sometime things don't whork at first time this way.

I should replace big parts of the gui (priority should be to free memory when loading a secon rom) but I don't have time now.

--------------------- MERGED ---------------------------

Hmm there is no sound in this on n3ds??? Am I the only one experiencing this?

Activating sound is a trivial task, syncronizing sound with frames isn't.

I'll not activate sound till you can confirm that framerate is fixed ad 50FPS (NTSC) or 60FPC (PAL/SECAM), otherwise sound will be very bad.

Please understand, I can't test any of this features on o3ds, so I can't make progresses without your feedbacks.
 
FPS limiter isn't working I'm afraid (tried toggling it on & off in the menu), Ms Pacman is getting 86/87fps for the PAL rom and 93/94fps for the NTSC rom. n3ds obviously.

BTW was probably just a typo in your post, but NTSC is 60fps and PAL is 50, not vice versa.

Perusing the code, you do have the 50 and 60 the wrong way around. Also is the FPSLimit flag meant to be declared as a double double (dd)? It's initialised to 1, but also it's toggled with FPSLimit = !FPSLimit; - does that work with a numerical value?


EDIT:
Made a few tweaks. Haven't learned pull requests yet sorry, guess I should do that next. Now the framerate is actually being limited, but it seems it's not quite right, reported fps is more like 67 for ntsc or 59/60 for pal.
I changed the FPSLimit variable to an int, changed its toggle code to 1 - FPSLimit, and in srv_Flip in flip.c you don't need to divide Ticks_per_Frame by 1000. I also tried changing hidKeysHeld to hidKeysDown in gui.c, but you can probably ignore that as it didn't seem to make much difference.
 

Attachments

Last edited by hippy dave,
FPS limiter isn't working I'm afraid (tried toggling it on & off in the menu), Ms Pacman is getting 86/87fps for the PAL rom and 93/94fps for the NTSC rom. n3ds obviously.

BTW was probably just a typo in your post, but NTSC is 60fps and PAL is 50, not vice versa.

Perusing the code, you do have the 50 and 60 the wrong way around. Also is the FPSLimit flag meant to be declared as a double double (dd)? It's initialised to 1, but also it's toggled with FPSLimit = !FPSLimit; - does that work with a numerical value?


EDIT:
Made a few tweaks. Haven't learned pull requests yet sorry, guess I should do that next. Now the framerate is actually being limited, but it seems it's not quite right, reported fps is more like 67 for ntsc or 59/60 for pal.
I changed the FPSLimit variable to an int, changed its toggle code to 1 - FPSLimit, and in srv_Flip in flip.c you don't need to divide Ticks_per_Frame by 1000. I also tried changing hidKeysHeld to hidKeysDown in gui.c, but you can probably ignore that as it didn't seem to make much difference.

dd is defined in the original code as

Code:
typedef unsigned int       dd;     /* define double */

so it's an unsigned int. Probably it's called dd (define double) because the programmer started coding the emulator on a old C compiler than ported it to a new one not changing the define d types.

For NTSC/PAL Framerate, I made a mistake. Also for dividing by 1000, I have to check the code, but probably I made a mistake converting from 3ds ticks (nanosecond) to SDL ticks (millisecond). There is a 10^6 factor handled partly in a getTick function and partly directly in code. I should clean it and call everywhere svcGetSystemTicks().

For the incorrect FPS limit, I'll check it. I'm lazy and tryed to do it quicly, but I could have adapted the code from Handy. Probably I'll do it this week.

Thank you for your help.

PS: for a pull request, I think you have to clone the git project, make the changes on your versione and the there shhould be an option for the pull request on the original repository.

EDIT: toggling with FPSLimit = !FPSLimit is not wrong if the wariable starts with a value of 0, but at some point I initialized it to 1 to have FPS limit enabled as default. I should have initialized it with:

FPSLimit = 0; FPSLimit = !FPSLimit

that is the same of FPSLimit = 0xffffffff;
 
Last edited by nop90,
  • Like
Reactions: hippy dave
@hippy dave

the right one should be:

Code:
  if(FPSLimit && (Now - PrevFrametime < Ticks_per_Frame/1000)) svcSleepThread(Ticks_per_Frame - (Now - PrevFrametime)*1000);

Ticks_per_Frame is in nanoseconds

Now and PrevFrametime are in microseconds

svcSleepThread needs nanoseconds as parameter

I will change every variable in nanosecond later.
 
The limiter honestly doesn't work with that line, it's back up to 93fps. If I take out both the /1000 and the *1000 then it's limited.
 
Now should work, check my github.

The showed FPS is not very precise, but timing should be ok for sound.
 
Looks good, great work! :) Only thing I noticed was that with the palette set to AUTO, it went to 50fps regardless of whether the rom was PAL or NTSC. Setting the palette manually correctly gives 50fps for PAL or 60fps for NTSC.
 
Looks good, great work! :) Only thing I noticed was that with the palette set to AUTO, it went to 50fps regardless of whether the rom was PAL or NTSC. Setting the palette manually correctly gives 50fps for PAL or 60fps for NTSC.

This is an important information to fix the code. The palette type is used by the original code to select different vertical offset for NTSC and PAL Games (NTSC has more scanlines).

I noticed that PAL games are centered while NTSC are not. Now I know that probably the video mode selection isn't working. I'll check this too.

For the possibility to force Palette type, that also changes video alignement, framerate (and soon sound frequency), don't know if this is a good thing or not.

For the moment I'll use it for testing, but I have to consider to find a different way to check video mode.
 
  • Like
Reactions: hippy dave
Yeah, this bit in carts.c looks like the primary region check:

Code:
if (UserPaletteNumber == 0xff) /* if user didn't specify a palette */
{
if (Lookup(NTSC_colours)) GamePaletteNumber = 0; /* NTSC Palette */
if (Lookup(PAL_colours)) GamePaletteNumber = 1; /* PAL Palette */
PaletteNumber = GamePaletteNumber;
}

So maybe GamePaletteNumber would be a better variable to check than PaletteNumber for this in 2600core.c
Code:
Ticks_per_Frame = (PaletteNumber == 0) ? TICKS_PER_FRAME_NTSC : TICKS_PER_FRAME_PAL;

..tho you might want it to check the rom's palette even if the user has specified one.
i.e. in carts.c something like:
Code:
if (Lookup(NTSC_colours)) GamePaletteNumber = 0; /* NTSC Palette */
if (Lookup(PAL_colours)) GamePaletteNumber = 1; /* PAL Palette */
if (UserPaletteNumber == 0xff) /* if user didn't specify a palette */
{
    PaletteNumber = GamePaletteNumber;
}
 
Last edited by hippy dave,
Sound has to wait some days more because I'm busy with work, but yesterday I made some quick hack to the screen rendering function that can speed up games on o3ds.

Enabling the "Skip blank pixel" oprion and setting frameskip to 4 most games can reach 40FPS with only little graphic deterioration.

The new version has also a lot of small fixes (menu option selection, screen centering, more precise timing for FPS limiter, ...)

You can build it yourself from my github if you want test it, or you can wait a new build this week end.
 

Site & Scene News

Popular threads in this forum