Vogtinator / gpsp

gpSP nspire port by calc84maniac
GNU General Public License v2.0
15 stars 3 forks source link

Doesn't run correctly on nSpire CX, screen glitched #3

Closed reasv closed 4 years ago

reasv commented 6 years ago

I have an nSpire CX -AB with the new screen and this emulator running in compatibility mode still lags significantly even with overclock.

So I tried to compile it myself to get it to run without compat-mode, but it it doesn't work. Whether I use the version I compiled myself or your release at #1 , while it doesn't start in compatibility mode, it's glitched and only part of the screen is occupied by the program, it also "flickers" a bit. When I try starting a game, the part of the screen occupied by the emulator becomes white and then it freezes forcing me to reset.

jpeg_20180410_162031

fghsgh commented 6 years ago

Same issue here with AB hw rev, also, games run incredibly slow (I have to keep MENU pressed for like 2 seconds before gpsp finds out) and I don't have patience to let games get past the loading screens so I don't know how slow it is exactly.

gameblabla commented 6 years ago

Looking at the source code, i'm a bit puzzled why it would do this. And i see that Vogt added a RGB555 screen mode and skipped some steps. (presumably in an attempt to make it faster?) It's also possible that it's simply due to the fact that it is an older build, RGB555 mode at the time was experimental.

Please give my build a try and also update your ndless_resources.tns file to the latest version. gpsp_lcd_blit_gcc73build.zip

fghsgh commented 6 years ago

I will try it later as I don't have time now. I thought it had something to do with the screen being rotated but not updating the dimensions (320x240 becomes 240x320 but the software keeps sending 320x240, so the first 320 gets cut to 240 and the second 240 causes the right strip to remain). I think my ndless_resources is up-to-date as other programs and games work just fine (both compatibility mode and not).

fghsgh commented 6 years ago

Even after updating ndless, it's not working. Only a square is rendered, the home screen flickers, and games run VERY slowly, like, unplayable slowly. It looks like only a white screen is shown when the game starts, but after pressing F for 4 seconds it changed, so that proves it's still running. Holding MENU for about the same time brings you back to the menu, from where you can then exit.

Also, I had a problem with my calc freezing between two starting-screen-banner-display things, but I think that is an issue with the ROM of the game. I have an actual cartridge of the game that's doing that and it works on my DS Lite. I think I'm not allowed to upload the ROM here, so I'm not doing that.

gameblabla commented 6 years ago

Sounds like the RGB555 mode is still broken then :/ I think a better idea might be to use the RGB565 mode instead like it used to.... That's something i'm gonna try

fghsgh commented 6 years ago

Thanks.

gameblabla commented 6 years ago

@fghsgh I discovered why Gpsp wouldn't work and i managed to make it work without any modifications ! It turns out the version of Ndless_resources shipped on ndless.me is too old and doesn't properly support RGB555. I compiled the Ndless from source here : https://github.com/Vogtinator/Ndless and it would work properly again.

Remove your ndless_resources.tns file and replace it with the file below (after decompressing it of course). ndless_res_new.zip

Reboot your calculator & reinstall Ndless again. Try my version of gpsp again and it should work ! Cheers

adriweb commented 6 years ago

Hmm, upstream is ahead by 20 commits, though, including one that fixes/improves the lcd compat mode, in r2012

gameblabla commented 6 years ago

@adriweb I did not notice that :P But since he submitted the fix for it, then using his fork is still good. It fixed the RGB555 color mode for me at least. Either way, last time i tried, the ndless_resources.tns from ndless.me was still too old but maybe they fixed that.

adriweb commented 6 years ago

The ndless.me download just redirects to the latest github release, though. which is the r2012 containing that "(r2012) lcd_compat mode: Save some memory and support transparency" commit... If it's broken with that, though, maybe you've found a bug :P

gameblabla commented 6 years ago

@adriweb Yeah, it still links to the older version. He added RGB555 but it wasn't working properly for me. Only after compiling it from source did i fix the issue.

adriweb commented 6 years ago

Weird - I don't know how that can be, since the file I get in the release is from November 2017, from the commit date :P The only things more recent than that are: https://github.com/ndless-nspire/Ndless/compare/7cfdcb1...master which aren't related, right?

gameblabla commented 6 years ago

Probably a GCC bug then... I'm not lying, you can try it yourself :eye:

adriweb commented 6 years ago

lol woops. @Vogtinator any input about this?

Vogtinator commented 6 years ago

This GPSP fork has --ndless-rev-min 2009, which means it should refuse to run on an older resources version.

If for some reason it still starts, it would not display anything as lcd_blit wouldn't know what to do with RGB555.

This means it's probably a regression introduced by https://github.com/ndless-nspire/Ndless/commit/e71c0e7a324dbc7f8e224fc29f0e40483aa419d1 - which would mean that the OS does weird stuff with that buffer. That would need to be investigated. Can you confirm that it still works with ndless master with that commit reverted?

gameblabla commented 6 years ago

Well i tried it again by, again, downloading ndless from ndless.me again and it still works with my precompiled gpsp. I mean, it used not to work before on the emulator (same issue as him), what the hell ? I even tried it with the emulated CR4 screen and it still works with my build. I also tried to reverse the commit you mentionned Vogtinator and it still works.

Sadly, i don't have my Nspire anymore (will only get it in a few months...) so @fghsgh or @reasv , could you try it again with an updated ndless_resource.tns ?

fghsgh commented 6 years ago

I have put the ndless_resources.tns @gameblabla sent on my calculator, restarted and re-installed ndless, but it still doesn't work. I have tried both the original version and the version @gameblabla sent above. Can someone send a newly compiled gpsp?

Vogtinator commented 6 years ago

@gameblabla I had the same - works fine in firebird but apparently not on real HW.

@fghsgh or @reasv: Can you check whether the battery icon in the top right changes if you plug/unplug the charger?

fghsgh commented 6 years ago

Do you mean in the os? Which screen of the os? Usually it changes.

Vogtinator commented 6 years ago

No, while gpsp is running and glitched.

fghsgh commented 6 years ago

Sorry, I can't try it as my battery is fully charged and the battery icon doesn't even update in the OS.

To drain battery, I'm letting it count from 1 to 999999 (which prevents sleep) on full brightness and charging my phone with the USB-cable. It seems the counting will keep it busy for some time.

EDIT: I got the battery down to 75% and the icon didn't even update in the OS... until I found out that the other end of the cable was not plugged in. Then, it still didn't work, because apparently it wasn't the same cable. After fixing that, it updated in the OS, but not in the program, neither turning on nor off.

EDIT: Could the slow speed have something to do with the timer hardware being locked on newer calculators (like the test mode LED)? I though I heard something like that. That could mean interrupts run much slower.

adriweb commented 6 years ago

I’m not sure what you mean with the timer stuff in recent hw revs (where did you hear/read that?) but in any case, in the OS, when you plug your calc’s USB the icon should change to indicate that it’s charging (some lightning icon IIRC?) or at least connected, anyway something different. I doubt this has changed on the hardware side...

fghsgh commented 6 years ago

It did change in the OS, not in the program.

I can't find where I read that. On some forum probably, about the LED. It's not in my browser history as far as I can see. It was something like "maybe they have put a protection on it, just like you have to write to [memory mapped port address] to enable access to the first timer".

Vogtinator commented 6 years ago

Ok, that rules out that the OS is somehow interfering with the timing, that means that GPSP itself does it :-/

That also explains why it behaves differently in the emulator. I'll do some tests.

Vogtinator commented 6 years ago

GPSP does indeed modify the timings and changes from the OS-defined 320x320 (sic!) to 320x240. On a 240x320 LCD that won't work. By implementing those registers in firebird, I got roughly the same behaviour on GPSP, so this should improve the situation.

I disabled lcd timing changes in this build, please give it a try: gpsp_launcher.zip

VoltageMiner commented 6 years ago

I've decided to jump into this as I have an nSpire CX CAS -AA model with 4.5.0.1180 installed. I used the ndless_resources.tns in ndless_res_new.zip provided by @gameblabla because the one provided in #1 crashes and reboots the system. Using the gpsp_launcher.tns from the gpsp_lcd_blit.zip provides the same image as @reasv uploaded. The launcher from @gameblabla , gpsp_lcd_blit_gcc73build.zip, has the same issue.

The latest launcher above, from @Vogtinator , correctly fills up the screen with the menu. When I launch a ROM, such as Pokemon FireRed, it starts off as a white screen and SLOWLY starts to display the Gamefreak/Nintendo copyright information.

Vogtinator commented 6 years ago

Ok, so the display issue is fixed, but now it's apparently a performance issue?

VoltageMiner commented 6 years ago

It's so slow that the original Alpha v0.11, released August 6,2012, is faster.

fghsgh commented 6 years ago

Same for me as for @ThunderRemix. Can this be the same issue as this TI-84+ emulator? That issue is mainly about invalid ROMs but there is also something there about speed.

fghsgh commented 6 years ago

I have found where I had seen the timer lock thing: https://www.omnimaga.org/other-calculator-discussion-and-news/turn-on-the-light-on-the-nspire/ search that page for "timer". It seems it should affect many more calculators than just HW-AA or AB, but it could have something to do with it.

EDIT: could it be 900B0018? Are you setting the value of this? It could be getting messed up by the OS on the newest hardware revisions, which would also explain why it does work on a regular HW-W but not on AA+.

EDIT: and the reason the original version does work could be because ndless's compatibility mode takes care of it.

VoltageMiner commented 6 years ago

Welp, two months later and still nothing. Someone has to send @Vogtinator a newer model calculator. xD

Vogtinator commented 6 years ago

EDIT: and the reason the original version does work could be because ndless's compatibility mode takes care of it.

ndless' compatibility mode only intercepts the LCD region and uses the watchdog timer to update the framebuffer periodically.

Vogtinator commented 5 years ago

This build includes a hack which force-enables caching and buffering for the framebuffer region, please give it a try:

gpsp_launcher.zip

(It's unstable so you might get flickering and crashes, but all I need to know is whether it runs at acceptable speed)

Vogtinator commented 5 years ago

(It's unstable so you might get flickering and crashes, but all I need to know is whether it runs at acceptable speed)

Here's a stable version: gpsp_launcher.zip

fghsgh commented 5 years ago

So, I tried your new stable version, and when I selected a ROM in the menu, it froze. Then, I started spamming buttons (esc, on, menu, F) and suddenly, it started running at a very decent speed. I would probably say it was the correct, original speed, if I had the actual game to try it on my DS Lite.

BMWeasel commented 5 years ago

That reddit guy here, tried the stable version out but when i loaded a ROM the screen turned white and never really changed & took a while to load and respond, although the menu did pop up when i pressed the button. But that might have to do with me mixing up the resources & config folders. =\

Update: The ROM loaded but its even slower than before

Vogtinator commented 5 years ago

So, I tried your new stable version, and when I selected a ROM in the menu, it froze. Then, I started spamming buttons (esc, on, menu, F) and suddenly, it started running at a very decent speed. I would probably say it was the correct, original speed, if I had the actual game to try it on my DS Lite.

Which ndless revision and version?

That reddit guy here, tried the stable version out but when i loaded a ROM the screen turned white and never really changed & took a while to load and respond, although the menu did pop up when i pressed the button. But that might have to do with me mixing up the resources & config folders. =\

Update: The ROM loaded but its even slower than before

Same question: Which ndless revision and version?

BMWeasel commented 5 years ago

I currently have version 4.5.0

fghsgh commented 5 years ago

OS: 4.4.0.532 HW: AB entire product id: P-0417AB ndless: 4.4.0 r2012, probably the newest in this thread but don't remember gpsp: the latest stable version you sent

The buttons I was spamming in the previous reply had no effect and it works fine without them. I still have some frameskip though, but games are playable.

Vogtinator commented 5 years ago

@BMWeasel, @fghsgh: Can you compare to the speed of the "old" gpsp on a pre-W CX calculator?

fghsgh commented 5 years ago

I don't have one, so that's a bit of a problem. Maybe I can find another GBA emulator for PC somewhere, or I'll record the screen and send a video.

fghsgh commented 5 years ago

I found out that it runs much slower (at least 2x, with fastest graphics settings) if you restart gpsp. The first time it was decent, then I closed gpsp and re-opened it, then it was slow. Rebooting didn't fix the issue (ctrl+on, then on, not a reset), but then, I left it off for a bit longer (maybe one hour) and then it worked again. Does this mean the OS resets the timer sometimes and gpsp relies on that?

Vogtinator commented 5 years ago

Rebooting didn't fix the issue (ctrl+on, then on, not a reset)

That barely does anything except turning off the screen.

I left it off for a bit longer (maybe one hour) and then it worked again. Does this mean the OS resets the timer sometimes and gpsp relies on that?

If that were the case, the issue would also happen in firebird, but it doesn't.

Does this also apply to the gpsp builds here before the cache tricks?

I'm pretty sure that the issue is caused by the caches, but I don't know which area and how - while the build I uploaded above has a substantial speedup with lcd_blit on my rev D calc, it doesn't seem to work as hoped on W+.

fghsgh commented 5 years ago

Does this also apply to the gpsp builds here before the cache tricks?

In those versions, it was so much slower that the current effect would be bottlenecked by the other slowdown.

If that were the case, the issue would also happen in firebird, but it doesn't.

The thing is that firebird only has HW-W, not HW-AB. And we don't even entirely know how all the hardware works, so emulating it will never be accurate.

That barely does anything except turning off the screen.

Then how do you explain the fact that it worked after leaving it off for longer? I didn't do anything else besides moving the mouse cursor around a bit, so there is no other difference.

Vogtinator commented 5 years ago

The thing is that firebird only has HW-W, not HW-AB. And we don't even entirely know how all the hardware works, so emulating it will never be accurate.

We know how gpsp works though.

Then how do you explain the fact that it worked after leaving it off for longer? I didn't do anything else besides moving the mouse cursor around a bit, so there is no other difference.

It goes into a deeper power saving mode after a while and at some point shuts down completely. That's configurable in the settings.

fghsgh commented 5 years ago

It goes into a deeper power saving mode after a while and at some point shuts down completely. That's configurable in the settings.

Do you mean Power Standby? That is 1 Minute. Hibernate is 4 Days, so that couldn't be it.

Oh look, it's faster again. It may be that 1 minute then.

We know how gpsp works though.

We know how gpsp works on hardware that we know. If we throw something we know works on one hardware at another hardware it may not work anymore, because of the differences. The differences between pre-W and post-W are quite well researched, but W and AB are not. And we know there are differences because it works on W but doesn't on AB.

Vogtinator commented 5 years ago

We know how gpsp works on hardware that we know. If we throw something we know works on one hardware at another hardware it may not work anymore, because of the differences. The differences between pre-W and post-W are quite well researched, but W and AB are not. And we know there are differences because it works on W but doesn't on AB.

That it works on W would be news to me.

fghsgh commented 5 years ago

That it works on W would be news to me.

Firebird emulates HW-W, and the description of this program says that it is for HW-W (or so I thought), so I thought it was tested. This would not be the first time something works on W but doesn't on AB. The main issues always seem to be display and timing.

Vogtinator commented 5 years ago

Firebird emulates HW-W, and the description of this program says that it is for HW-W (or so I thought), so I thought it was tested.

You misunderstood - the program is for testing on HW-W, not tested on HW-W.

This would not be the first time something works on W but doesn't on AB. The main issues always seem to be display and timing.

Do you have examples?

fghsgh commented 5 years ago

You misunderstood - the program is for testing on HW-W, not tested on HW-W.

Okay. My fault. But given that it worked in Firebird it is quite normal to assume it would work on a real HW-W calculator too.

Do you have examples?

When I got this calc, I immediately started putting programs on it only to find out that most of them didn't work. Gpsp was also one of them until you partially fixed it.

Oh look, it's back to the first speed (the unplayable one) again. I'd say about 30 seconds per frame (with no scaling and frameskip automatic 4 uniform). It just faded from black to the first starting screen. The F button does nothing visible.

Okay, I closed gpsp, went to home screen, turned off, turned on, opened gpsp and it was back to full speed. Odd... This really seems like relying on the OS to set the timer (which was normally always done on W, but on AB sometimes not, it seems to me). How else could you explain the fact that it sometimes works and other times it doesn't, with the only difference being what screen the calc was on when I turned it off and whether gpsp was already run in this session?

I just realized I haven't been thankful enough to you for actually doing all of this. You're actually trying your best to help people (really stubborn ones like me) with their problems and you've been really responsive lately. Thank you.