Linux On iPod Forum Index
 FAQ  •  Search  •  Memberlist  •  Usergroups  •  Profile  •  Log in to check your private messages  •  Log in
 igpSP 0.9-2Xb K5 - GameBoy Advance Emulator [50-80%] View next topic
View previous topic
Post new topicReply to topic
Author Message
Keripo
Contributor


Joined: 26 Jul 2007


PostPosted: Sun May 04, 2008 2:12 am Reply with quoteBack to top

After doing source code diffs with Zaphod's original gpSP port and zacaj's later port, I did a full and proper re-port of the Exophase's latest version of gpSP. My build uses iPod-specific code rewritten based on Zaphod's changes and the iBoy source code and adds many features that can improve usage or offer emulation speed-ups.

There are two versions: one with sound and one without sound. It is recommended that you use the binary without sound as it is faster (and sound quality is very choppy anyway). The download also includes the iPod-specific source code, which can be also adapted in the future for porting other emulators).

For installation and usage information, read the "ReadMe from Keripo.txt" file in the download. For information on gpSP itself, read the documents in the "doc" folder. Other than that, enjoy and leave your results/feedback here!

Download:
http://ipodlinux.org/Image:IgpSP-0.9-2Xb-K5.tar.gz

~Keripo

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/

Me = Keripo, Keripo Test Account = Me
010/001/111

Last edited by Keripo on Wed Jun 04, 2008 10:29 pm; edited 8 times in total
View user's profileSend private message
Excimer



Joined: 12 Apr 2007


PostPosted: Sun May 04, 2008 10:58 pm Reply with quoteBack to top

I've resumed working on gpSP as well, although it's a little slow going for now (will take a while to get into as I'm still weening off my PCE emulator). Hopefully that'll mean more improvements for ARM and in general. My old work from last year has already improved things a little. There are a ton of things I wanted to implement and I've also learned some new techniques and have gotten better at ARM coding since then thanks to the PCE emulator. I still doubt it'll ever be that great on iPod though.

You might want to try notaz's recent build for GP2X as well, since it uses auto-profiling for a slight speedup.

Let me know if you ever want to talk about optimization techniques or whatever. You can find me on AIM/MSN/Yahoo (Exophase, [email protected], espfusion) or IRC (Exophase on efnet)

(this is splitting hairs, but the branch of the GP2X version you're using is actually almost entirely separate from the one zodttd did beforehand)
View user's profileSend private message
zowki



Joined: 17 Sep 2006

Location: /mnt/zowki

PostPosted: Mon May 05, 2008 12:41 pm Reply with quoteBack to top

How do I use the patch file? Anyways I tried the binary without the patch and it works incredibly well! Its aster than zacaj's version, I can now play Final Fantasy Tactics Advance at about 70% while it was around 50% previously. Keep up the good work keripo! And Exophase as the original programmer for gpSP, you are welcome to help too!

Edit: Mario Advance 2 is still not very playable, it lags too much and the button reaction is too slow. I guess igpsp is only useful for tactical gba games right now.

_________________
My ipods:
iPod Nano 1G 2GB
iPod Video 5g 60GB
View user's profileSend private messageSend e-mailMSN Messenger
Keripo
Contributor


Joined: 26 Jul 2007


PostPosted: Mon May 05, 2008 10:41 pm Reply with quoteBack to top

I did a proper cleanup of the pixel drawing code and now things run noticeably faster. I also fixed up the clear_screen code and modified the menu text so that the menu displays properly and compactly. I also removed zip file support (trimmed a few kbs off the binary - using zipped roms will be extremely slow anyway). I did a few speed tests with various changes and compared to my PSP. Won't bother doing a proper benchmark but here are the stop-watch timed results. Keep in mind that FFTA is already a pretty high-end game but I still consider the speed "playable" - other simpler games, especially homebrew ones, will run much faster. Also keep in mind that I just timed the graphics-only intro and didn't bother testing gameplay (which may be quite different in speed)
Code:
With Final Fantasy Tactics Advance, timed up to the main menu ("Press start").

iPod nano, official 0.9-2Xb, frameskip 6, scaled, with sound 44100Hz
1 min 50 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, with sound 44100Hz
1 min 55 sec

iPod nano, official 0.9-2Xb, frameskip 6, scaled, with sound 22050Hz
1 min 47 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, with sound 22050Hz
1 min 52 sec

iPod nano, official 0.9-2Xb, frameskip 6, scaled, sound removed
1 min 43 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, sound removed
1 min 49 sec

PSP fat, 3.90 M33-2, official 0.8, frameskip 0, scaled 3:2, with sound 44100Hz
52 sec

From the above results, it seems that neither frameskip nor sound really makes any speed changes so its probably the actual GBA processing thats slowing things down (I'm not familiar with emulators so I'm just guessing). Using 22050Hz sound frequency didn't offer much speedup and not worth the very crappy sound quality that came out (the 44100Hz sound was still very choppy for FFTA but at least sounded like background music). Compared to the PSP though (which is using an older version at no frameskip and not as optimized with its MIPS core but still with a 222MHz processor and graphics chip), it's far slower, as expected. As well, my iPod is a flash-based, small-screen iPod nano so emulation will be much slower on the other models. But still "playable".


Exophase:
To be honest I'm very new at this stuff with both my knowledge of hardware and optimization limited to only what I can google. I tried adding in video_blend.S but the emulator froze upon the first instance of alpha blending (when the text fades in during FFTA's intro). Without any knowledge of assembly, I don't think there's much I can do there other than hope you have time to look into it. I searched up notaz's build and, while I found the binaries, I didn't find any source code. I have no idea what "auto-profiling" is and, from the GP2X wiki, it seems that his changes involved the mmuhack which won't work on the iPod. The only way I can really speed things up with this emulator is rewrite both the menu and pixel drawing code to use hotdog (a fast, made-for-iPod graphics engine) and make the co-processor handle more of the calculations.

Another issue I'm having is with the menu and font. The menu size seems to be set to a fixed dimension/ratio and the "Cheats and Miscellaneous options" line gets cut off at "op". The font size is also very small and changing the width and height values in font.h didn't do much. I was wondering if you can direct me to the section which handles the menu dimensions as I can't seem to find it. On a side note, if you think there are any parts with calculations that could be sped up by using the co-processor, I would be grateful if you noted that as well.

Like you said, however, I agree that the chances of the emulator becoming any faster (unless you break out with some mad ARM-optimizations) are pretty slim. Still, with many simpler/homebrew games running at full speed, it's a neat little port. And if memory serves, its currently faster than the PSP's old VBA port that many people used before you came along Wink

~Keripo

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/

Me = Keripo, Keripo Test Account = Me
010/001/111
View user's profileSend private message
zowki



Joined: 17 Sep 2006

Location: /mnt/zowki

PostPosted: Tue May 06, 2008 2:00 am Reply with quoteBack to top

The GBA has a 16.8 MHz 32-bit ARM7TDMI cpu which is similair to the ipod's processor. Running at only 16.8mhz the ipod's processor is 3 times more powerful (Something like 75mhz for the ipod nano). Also the gba's ram is 128kb while the ipod nano's ram is 16mb. So full emulation should be very possible! Very Happy

_________________
My ipods:
iPod Nano 1G 2GB
iPod Video 5g 60GB
View user's profileSend private messageSend e-mailMSN Messenger
Excimer



Joined: 12 Apr 2007


PostPosted: Tue May 06, 2008 3:03 am Reply with quoteBack to top

zowki wrote:
The GBA has a 16.8 MHz 32-bit ARM7TDMI cpu which is similair to the ipod's processor. Running at only 16.8mhz the ipod's processor is 3 times more powerful (Something like 75mhz for the ipod nano). Also the gba's ram is 128kb while the ipod nano's ram is 16mb. So full emulation should be very possible! Very Happy


It isn't that simple at all (and GBA has 32 + 256KB of RAM and up to 32MB of ROM, not that it really matters). You can't just run the GBA code on iPod, it has to be intercepted and translated to something that can be ran on iPod. All of the memory accesses have to be dealt with in general code and if they access hardware it can get expensive (some games write to I/O thousands of times a frame). Indirect branches also have to specially dealt with to link to the proper sections. Not to mention emulating the rest of the hardware, especially the video, which really iPod probably isn't even powerful enough to do in isolation.

All of this is probably further hurt by the relatively small amount of cache that iPod has per core (only 8KB). Since it's unified all it really takes is a lot of cache misses from loads to start causing misses on a lot of instruction fetches. GBA code isn't written with cache in mind and it's at least 4x larger after being translated. If the fast RAM could be well utilized somehow that'd probably help.

I have lots of plans to try to improve things, how much I don't really know, but iPod is just too weak.

Keripo; Frameskip surely makes a huge difference, but from 0-2, after 4 you start hitting serious diminishing returns because you're already skipping most of the frames. There's a benchmark mode in gpSP, comment out the first return in trigger_ext_event, in main.c. I'm going to make this a command line option later, also going to completely change the menu. However, gpSP is going closed source so you'll have to keep in touch with me to get the source code.
View user's profileSend private message
zowki



Joined: 17 Sep 2006

Location: /mnt/zowki

PostPosted: Tue May 06, 2008 2:34 pm Reply with quoteBack to top

Keripo wrote:
I did a proper cleanup of the pixel drawing code and now things run noticeably faster. I also fixed up the clear_screen code and modified the menu text so that the menu displays properly and compactly. I also removed zip file support (trimmed a few kbs off the binary - using zipped roms will be extremely slow anyway). I did a few speed tests with various changes and compared to my PSP. Won't bother doing a proper benchmark but here are the stop-watch timed results. Keep in mind that FFTA is already a pretty high-end game but I still consider the speed "playable" - other simpler games, especially homebrew ones, will run much faster. Also keep in mind that I just timed the graphics-only intro and didn't bother testing gameplay (which may be quite different in speed)
Code:
With Final Fantasy Tactics Advance, timed up to the main menu ("Press start").

iPod nano, official 0.9-2Xb, frameskip 6, scaled, with sound 44100Hz
1 min 50 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, with sound 44100Hz
1 min 55 sec

iPod nano, official 0.9-2Xb, frameskip 6, scaled, with sound 22050Hz
1 min 47 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, with sound 22050Hz
1 min 52 sec

iPod nano, official 0.9-2Xb, frameskip 6, scaled, sound removed
1 min 43 sec

iPod nano, official 0.9-2Xb, frameskip 4, scaled, sound removed
1 min 49 sec

PSP fat, 3.90 M33-2, official 0.8, frameskip 0, scaled 3:2, with sound 44100Hz
52 sec

From the above results, it seems that neither frameskip nor sound really makes any speed changes so its probably the actual GBA processing thats slowing things down (I'm not familiar with emulators so I'm just guessing). Using 22050Hz sound frequency didn't offer much speedup and not worth the very crappy sound quality that came out (the 44100Hz sound was still very choppy for FFTA but at least sounded like background music). Compared to the PSP though (which is using an older version at no frameskip and not as optimized with its MIPS core but still with a 222MHz processor and graphics chip), it's far slower, as expected. As well, my iPod is a flash-based, small-screen iPod nano so emulation will be much slower on the other models. But still "playable".


Exophase:
To be honest I'm very new at this stuff with both my knowledge of hardware and optimization limited to only what I can google. I tried adding in video_blend.S but the emulator froze upon the first instance of alpha blending (when the text fades in during FFTA's intro). Without any knowledge of assembly, I don't think there's much I can do there other than hope you have time to look into it. I searched up notaz's build and, while I found the binaries, I didn't find any source code. I have no idea what "auto-profiling" is and, from the GP2X wiki, it seems that his changes involved the mmuhack which won't work on the iPod. The only way I can really speed things up with this emulator is rewrite both the menu and pixel drawing code to use hotdog (a fast, made-for-iPod graphics engine) and make the co-processor handle more of the calculations.

Another issue I'm having is with the menu and font. The menu size seems to be set to a fixed dimension/ratio and the "Cheats and Miscellaneous options" line gets cut off at "op". The font size is also very small and changing the width and height values in font.h didn't do much. I was wondering if you can direct me to the section which handles the menu dimensions as I can't seem to find it. On a side note, if you think there are any parts with calculations that could be sped up by using the co-processor, I would be grateful if you noted that as well.

Like you said, however, I agree that the chances of the emulator becoming any faster (unless you break out with some mad ARM-optimizations) are pretty slim. Still, with many simpler/homebrew games running at full speed, it's a neat little port. And if memory serves, its currently faster than the PSP's old VBA port that many people used before you came along Wink

~Keripo

I have seen some significant improvements in this version! I can say that Super Mario Advance 2 is now very playable at frameskip set to 2. The button response is faster now! But I have not noticed little difference in final fantasy tactics advance, the framerate may have been boosted by a bit that I can only just notice. Good job anyways, still looking forward to your releases

-zowki

_________________
My ipods:
iPod Nano 1G 2GB
iPod Video 5g 60GB
View user's profileSend private messageSend e-mailMSN Messenger
xs



Joined: 26 Sep 2007


PostPosted: Wed May 07, 2008 2:14 pm Reply with quoteBack to top

Now igpSP is very stable... Thank you very much(I merged it into iPLGotta).
View user's profileSend private message
Keripo
Contributor


Joined: 26 Jul 2007


PostPosted: Sun May 11, 2008 10:21 pm Reply with quoteBack to top

Third release, further speed ups. Added proper documentation to download and included "game_config.txt" file (somehow forgot in previous releases). A ZeroSlackr Pack will come soon (just be patient).

- Full, complete removal of sound - the no-sound build is noticeably faster
- Cleaned up screen blitting code (Zaphod wrote quite a lot of redundant, processor-slowing-down code)
- Added alpha blending on/off setting (can add speed-up at cost of graphics)
- Binary shift for a few operations (small speed-up for both builds; Exophase blames gcc's stupidity)

For those who are interested in numbers, here are the tests.
Final Fantasy Tactics Advance intro animation
Code:
Frameskip 0: 2 min 55 sec
Frameskip 1: 2 min  8 sec
Frameskip 2: 1 min 52 sec
Frameskip 3: 1 min 44 sec
Frameskip 4: 1 min 40 sec
Frameskip 5: 1 min 36 sec
Frameskip 6: 1 min 34 sec

Frameskip 99: 1 min 25 sec
Frameskip 4 no alpha: 1 min 35 sec
Frameskip 4 with sound: 1 min 48 sec
PSP Frameskip 0: 52 sec

Final Fantasy Tactics Advance gameplay (two NPC turns)
Code:
Frameskip 4: 1 min 10 sec
Frameskip 6: 1 min 5 sec
Frameskip 6 no alpha: 1 min 2 sec
PSP Frameskip 0: 27 sec


Castlevania: Aria of Sorrows name selection screen
On iPod, no sound build:
Code:
Full test   : 23440 ms
No blending : 14300 ms
No video    : 6160 ms
No CPU      : 17730 ms
No CPU/video: 1100 ms

CPU speed   : 5060 ms
Video speed : 17280 ms
Alpha cost  : 9140 ms

On GP2X, with ARM alpha blending pass:
Code:
Full test : 6456 ms
No blending : 5379 ms
No video : 2241 ms
No CPU : 4392 ms
No CPU/video: 361 ms

CPU speed : 1880 ms
Video speed : 4215 ms
Alpha cost : 1077 ms


As a last note, for those who insist that even my build of gpSP runs at 70% of full speed or higher, stop dreaming. The iPod version runs between 1/3 to 1/2 of the PSP and GP2X builds (with the GP2X not always 100% speed). "Playable" is different from "full-speed".

Future releases will probably only be improvements/cleanups of the iPod-specific code and will not experience much speed-ups. Any future speed-ups will be thanks to new updates from Exophase. igpSP isn't going to get any faster than this (unless someone with good knowledge of assembly is willing to help optimize the assembly output).

~Keripo

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/

Me = Keripo, Keripo Test Account = Me
010/001/111

Last edited by Keripo on Mon May 12, 2008 1:40 am; edited 1 time in total
View user's profileSend private message
zowki



Joined: 17 Sep 2006

Location: /mnt/zowki

PostPosted: Mon May 12, 2008 1:34 am Reply with quoteBack to top

Wow a new release! I am definitely trying this out when I get back home from school!

Edit: I just got back from school and tested it out. I must say its far better than I expected! Slight speedups for Final Fantasy Tactics Advance and Super Mario Advance classic mode runs at 100%. If you are wondering how I got SMA classic mode to run so fast, I used the no sound version, set frameskip to 4 (3 works but at times it may go to 96%) and turned alpha blending off. The normal adventure mode in SMA runs at about 70% though. Great job on this release Keripo! Just one development request not related to speed. Is there a way to make the menu have clearer text for the ipod nano? Its fine on my 5g but its a pain to navigate on my nano.

_________________
My ipods:
iPod Nano 1G 2GB
iPod Video 5g 60GB
View user's profileSend private messageSend e-mailMSN Messenger
Keripo
Contributor


Joined: 26 Jul 2007


PostPosted: Fri May 23, 2008 12:29 am Reply with quoteBack to top

K4 release. No emulator optimizations but loads of new features! For download and info, see the first post. MAKE SURE TO READ THE "ReadMe from Keripo.txt" BEFORE INSTALLING! All new features and how to use them are documented there. Remember that K4 does not save the iPod-specific settings - I'll add setting saving in K5 or later.

Here are the speed test numbers (without a game_config.txt")
Code:
Final Fantasy Tactics Advance stopwatch tests:

K3 build: (No sound, 75MHz, full-screen, alpha on)
Frameskip 4: 1 min 40 sec
Frameskip 6: 1 min 34 sec

Old K3 settings: (No sound, 75MHz, full-screen, alpha on)
Frameskip 4: 1 min 41 sec
Frameskip 6: 1 min 35 sec

Default K4 settings: (No sound, 78MHz, scale to width, alpha on)
Frameskip 4: 1 min 36 sec
Frameskip 6: 1 min 31 sec

Speed K4 settings: (No sound, 81MHz, scale to width, no alpha)
Frameskip 4: 1 min 28 sec
Frameskip 6: 1 min 24 sec


Castlevania: Aria of Sorrow benchmark tests:

75MHz, scale to width:
   CPU speed   : 5180 ms
   Video speed : 17280 ms
   Alpha cost  : 9190 ms

78MHz, scale to width:
   CPU speed   : 4990 ms
   Video speed : 16620 ms
   Alpha cost  : 8800 ms

81MHz, scale to width:
   CPU speed   : 4790 ms
   Video speed : 15980 ms
   Alpha cost  : 8500 ms


K3 build benchmark
   CPU speed   : 5060 ms
   Video speed : 17280 ms
   Alpha cost  : 9140 ms

GP2X benchmark:
   CPU speed   : 1880 ms
   Video speed : 4215 ms
   Alpha cost  : 1077 ms

Note that I won't be making a new ZeroSlackr pack for this though - if you want a ZeroSlackr pack for igpSP K4, build it yourself from SVN.

On a side note, it seems that igpSP does not work on 4Gs and probably other monochrome iPods. If you have a monochrome iPod and are willing to help me with testing, please PM me. If you have a non-monochrome, non-nano, non-video iPod, please post whether or not igpSP works for your iPod model. Thanks!

~Keripo

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/

Me = Keripo, Keripo Test Account = Me
010/001/111

Last edited by Keripo on Fri May 23, 2008 4:00 pm; edited 3 times in total
View user's profileSend private message
zowki



Joined: 17 Sep 2006

Location: /mnt/zowki

PostPosted: Fri May 23, 2008 1:44 am Reply with quoteBack to top

Keripo you are an ipl god!! I'm in school right now and I feel like calling in sick just to go home and install this new version! Laughing
I'll post my success with it and speeds it runs when I get home in about 5 hours. I can't concentrate in my studies right now since I'm so desperate to get my hands on igpSP K4! Shocked

EDIT: After much waiting and anticipation I'm finally back from school and have tested this new version. Final Fantasy Tactics advance is far more playable now in both the no-sound and sound version. Super Mario Advance has no difference in the sound version but is clearly a lot faster in the no-sound version (It actually runs classic mode full speed with barely visible frameskip). Alpha blending in Final Fantasy Tactics advance makes it only slightly faster but causing some flickering. Alpha blending in Super Mario Advance makes mario have no body and skim around on the floor). Sadly Pokemon Ruby and Mario Kart Advance still has a white screen at startup.

EDIT 2: I have observed the speeds on my 5g ipod compared to my nano and it seems like the 5g runs slower. It must be because it has to render a larger resolution. So classic mode in SMA runs fullspeed only on my nano. So 5g users dont flame me when I say it runs fullspeed because I mean it only on my nano.

_________________
My ipods:
iPod Nano 1G 2GB
iPod Video 5g 60GB
View user's profileSend private messageSend e-mailMSN Messenger
rasenman



Joined: 25 Apr 2008


PostPosted: Fri May 30, 2008 10:53 pm Reply with quoteBack to top

man time i dont post well i got to say that the emulator is quite fast i can easly play ffta, and it added medabots and a few yugi oh games to the compatibility list, thanks keripo, keep up the good work
View user's profileSend private message
Keripo Test Account
Contributor


Joined: 11 Apr 2006

Location: Ontario, Canada

PostPosted: Fri May 30, 2008 11:46 pm Reply with quoteBack to top

The slower speed on the 5G is more likely due to it having a bigger screen for hotdog to blit to and because data is being read from a hard-drive.
The added compatibility is not from my changes; it is from the game_config.txt file. That file is quite important as it has tweaks that make many games work and some games run faster. For rom compatibility lists, you should instead search the PSP and GP2X forums.

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/
http://ipodlinux.org/forums/viewtopic.php?t=29636
View user's profileSend private messageSend e-mailVisit poster's websiteAIM AddressMSN Messenger
Keripo
Contributor


Joined: 26 Jul 2007


PostPosted: Wed Jun 04, 2008 10:24 pm Reply with quoteBack to top

K5 release. Slight optimizations here and there, but also slight slowdowns here and there (no real net change in speed). Tons of new features added though. Here's the changelog:
Code:
== Changelog ==
K5:
- Fixed sound output - no longer as crappy!
- Fixed L/R trigger mapping so touch doesn't conflict
- Rewrote scaling code and added centring code
  (scale to width and fullscreen for 5G iPods should be faster)
- Resorted menus a bit
- Completed no-sound hack (now sound support 100% removed)
- Added support for monochrome iPod
  (slower than colour iPods due to extra pixel conversions)
- Added volume control
- Added rapid-fire setting for touch A and B
- Added 66MHz CPU speed (mostly for PSP comparison purposes)
- Added synchronize_flag toggle (very slight speed-up)
- Added partial video_blend expand_normal assembly borrowed from
  GP2X build (screen blending faster and no more random pixels)
- Added screen smoothing setting (very minimal slowdown)


Setting saving has still not yet been added but so many fixes/features have been added that I might as well just make this release. Please thoroughly read the "ReadMe from Keripo.txt" document to understand how to use all the added features. For K5's benchtesting numbers, see "docs/igpSP-K5-vs-PSP-Tests.txt". Also, please take a look at this thread.

~Keripo

_________________
Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/

Me = Keripo, Keripo Test Account = Me
010/001/111
View user's profileSend private message
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme :: All times are GMT