Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
reasv opened this issue Apr 10, 2018 · 93 comments
Closed

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

reasv opened this issue Apr 10, 2018 · 93 comments

Comments

@reasv
Copy link

reasv commented Apr 10, 2018

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
Copy link

fghsgh commented May 24, 2018

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
Copy link

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
Copy link

fghsgh commented May 27, 2018

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
Copy link

fghsgh commented May 28, 2018

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
Copy link

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
Copy link

fghsgh commented May 29, 2018

Thanks.

@gameblabla
Copy link

gameblabla commented Jun 10, 2018

@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
Copy link

adriweb commented Jun 10, 2018

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

@gameblabla
Copy link

gameblabla commented Jun 10, 2018

@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
Copy link

adriweb commented Jun 10, 2018

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
Copy link

@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
Copy link

adriweb commented Jun 10, 2018

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: ndless-nspire/Ndless@7cfdcb1...master which aren't related, right?

@gameblabla
Copy link

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

@adriweb
Copy link

adriweb commented Jun 10, 2018

lol woops. @Vogtinator any input about this?

@Vogtinator
Copy link
Owner

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 ndless-nspire/Ndless@e71c0e7 - 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
Copy link

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
Copy link

fghsgh commented Jun 15, 2018

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
Copy link
Owner

@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
Copy link

fghsgh commented Jun 16, 2018

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

@Vogtinator
Copy link
Owner

No, while gpsp is running and glitched.

@fghsgh
Copy link

fghsgh commented Jun 18, 2018

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
Copy link

adriweb commented Jun 18, 2018

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
Copy link

fghsgh commented Jun 19, 2018

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
Copy link
Owner

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 added a commit that referenced this issue Jun 19, 2018
@Vogtinator
Copy link
Owner

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
Copy link

VoltageMiner commented Jun 22, 2018

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
Copy link
Owner

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

@VoltageMiner
Copy link

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

@fghsgh
Copy link

fghsgh commented Jun 24, 2018

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.

@adriweb
Copy link

adriweb commented Feb 6, 2019

Yes my 2nd sentence solves potential issues for future versions - my first one is true for the time being though :P

@fghsgh
Copy link

fghsgh commented Feb 6, 2019

Okay, so I'll install ndless 4.5 then.

In the meantime, I found out this while running slower (the 2x one):

  • turning off frameskip doesn't slow it down, the frames are closer together (as it should)
  • putting it into fast mode will make frameskip higher, and it runs faster, but not as fast as when it's not slowed down, fast mode has basically no effect in that case
  • scaled/blended mode (graphics options) is just as fast as unscaled mode

I stopwatched the framerate in the very slow mode: 4.4 seconds. The larger numbers I was talking about before were with frameskip on. This is also the maximal time you'd have to keep a button pressed for before it is detected. It's also the same time for particles.

Updating ndless didn't fix the issue. And particles, link and colors are all still running in compatibility mode.

Okay, so I got particles running at a fluent speed just by restarting the program, but there are still some graphical glitches. When I tried to record it, it didn't work. It's back to being 4.4 seconds per frame. What is weird here is that particles doesn't slow down the actual particles, just the framerate. Gpsp also slows down the game.

Update: I didn't manage to open gpsp once with it running quickly since upgrading ndless. I'm going back to 4.4.

@BMWeasel
Copy link

I just remembered that this existed, 5 months later after finals =|. Either way I thought I would throw the few cents i had left over here.
HW rev: AC
OS ver: 4.5.0.1180
ndless ver: 4.5.0
So far with the latest version there is no compatibility issue prompt but the games run at 6fpm. the menu button needs to be held down to exit (I'm assuming its just waiting for the next frame[also running overclocked])
If anyone with the skills to work on this gets bored enough to try something I'm here now =P

@fghsgh
Copy link

fghsgh commented Jul 27, 2019

I'm still here too. The problem are the skills (I'm not very comfortable with the ndless API).

@Led1-ch
Copy link

Led1-ch commented Feb 26, 2020

Not sure if anyone is still working on this but here is my info:
HW rev: AD
OS: 4.5.0.1180
ndless: 4.5.0 (compiled from source 2/26/2020)

So basically I tried every single variation of the gpsp posted in this thread and they were all horrendously slow. The only one that was slightly playable was the one where msleep was disabled and that was still very very slow. On the other hand, gpsp in compatibility mode works completely fine! It is a tad slow even with overclocking so real time games are difficult to play.

I am graduating soon and will have some free time so I'm considering writing a new emulator from scratch so it will be compatible with the new lcd api of ndless. @Vogtinator how much c++ support does ndless have or should I write it completely in c only.

@Vogtinator
Copy link
Owner

@Vogtinator how much c++ support does ndless have or should I write it completely in c only.

Full. I never tried std::filesystem though, that might be broken.

@fghsgh
Copy link

fghsgh commented Feb 26, 2020

@Led1-ch good luck and I'm hoping for the best! Though it did work sometimes with ndless 4.4...

@Vogtinator
Copy link
Owner

Please try Ndless with a completely different approach of LCD compatibility from here: ndless-nspire/Ndless#202 (comment)

With this, the applications should work much better.

@fghsgh
Copy link

fghsgh commented Mar 4, 2020

The LCD was already working quite decently, it must be some kind of timer that causes the issue. First time I ran this, it was slow, but not unbearably slow. I think I was maybe getting 2 fps (and the whole gameplay was slowed down, regardless of how much frameskip I set). However, the second time I ran it, it took 63 seconds (and I'm not exaggerating, I stopwatched it) between choosing "Return to game" and seeing the first frame of the game. Then, I had to keep menu pressed for multiple seconds before it would open the menu again. I had to wait out the 60 seconds another time and then I had to press left for another 48 or so before the character moved one frame.

Could you send a version that doesn't try to match the speed to a real GBA? I'm talking about doing what Crafti does and not caring about time too much.

@Vogtinator
Copy link
Owner

@fghsgh This approach of using lcd_blit is flawed by design and can't really work well, so just try the original gpsp builds instead.

@fghsgh
Copy link

fghsgh commented Mar 4, 2020

@Vogtinator where can I find that? I suck at GitHub.

@Led1-ch
Copy link

Led1-ch commented Mar 4, 2020

I will try out the new ndless resoures in a few hours but the fact that msleep being disabled significantly speed up the lcd_blit emulator for me means that it's somehow detecting the fps wrong and sleeping too long. But even then I'm not really sure what the issue is. There's also a significant slow down when playing romhacks that do C script insertion instead of straight assembly hacking whereas on the original gpsp it's fine so I'm not sure what's going on there either. Maybe because the C scripts often include checks during the main game loop the nspire can't keep up?

@fghsgh you can find the original build on the ndless apps or on ti-planet. The source code is lost for it I think.

@Vogtinator
Copy link
Owner

@Vogtinator where can I find that? I suck at GitHub.

https://www.ticalc.org/archives/files/fileinfo/449/44971.html

@fghsgh you can find the original build on the ndless apps or on ti-planet. The source code is lost for it I think.

Nope, this repo is based on the tarball. The gbc4nspire sources were lost.

@fghsgh
Copy link

fghsgh commented Mar 4, 2020

The speed at which that one runs is great. However, the ndless compatibility mode seems broken. It seems to be very stable but it is still unplayable because of the broken compatibility mode. Here is a picture of the Pokemon Firered startscreen:
compat_mode_broken

@Vogtinator
Copy link
Owner

Which HW revision is that calc? It's confirmed to work on HW-Y and below with insufficient data for others.

@fghsgh
Copy link

fghsgh commented Mar 4, 2020

AB, see above

@Vogtinator
Copy link
Owner

Ok, so for Z+ calcs it still needs some work. They probably switched the display model...

@fghsgh
Copy link

fghsgh commented Mar 4, 2020

...which could explain the first issue with the display only being 240x240.

@Vogtinator
Copy link
Owner

No, that was the display initialization code configuring the LCD controller to output 320x240px while drawing 240x320px. That's fixed in b7e972d

@Led1-ch
Copy link

Led1-ch commented Mar 4, 2020

The original build is unstable after about 5 runs it forgets where the bios is for revision AD but the LCD display is fine. Like I said it's about half as slow as pre W revision (i compared to overclocked revision D from my friend)

@Led1-ch
Copy link

Led1-ch commented Mar 5, 2020

Okay so with the new resources and the original gpsp I get a screen similar to fghsgh. Lots of lines everywhere and also tilted the wrong way. With the lcd gpsp I get a black screen after using the menu and I ended up having to restart my calculator. Does this mean that revisions like AB and AD have the pre W dimensions just with an lcd display and that the slowdown on the original gpsp is simply due to the rendering speed and is that fixable? I noticed that the original gpsp was released in 2012 while the SDK graphics for ndless was released in 2013 maybe using that library will make it run faster?

@fghsgh
Copy link

fghsgh commented Mar 5, 2020

@Vogtinator You left the IRC room, so I'm writing this here, as it's the only other way I have to contact you:
I restarted the calculator (ctrl + on, on), and the inverting and on/off commands worked. Writing FFFFF caused a dark green, which inverted was magenta. I think this is due to the restart, not because of the I/O the program did. This has also happened on gpsp already. The rectangle was still messed up, though. The read bytes were 0x1ff, 0x01, 0x10a, 0x148.

@Vogtinator
Copy link
Owner

Vogtinator commented Mar 6, 2020

@Vogtinator You left the IRC room, so I'm writing this here, as it's the only other way I have to contact you:

Just write in IRC, I'll read it later.

I restarted the calculator (ctrl + on, on), and the inverting and on/off commands worked. Writing FFFFF caused a dark green, which inverted was magenta. I think this is due to the restart, not because of the I/O the program did.

Yes, that it works after "restarting" (which is actually just idle mode) can be explained by the OS using SPI to turn the display off and back on again. That the commands now worked means that the communication with the chip still works, just some initialization is missing. Question is now what has to be done, maybe setting CS differently, some GPIO pin or some other hidden clock configuration.

This has also happened on gpsp already. The rectangle was still messed up, though. The read bytes were 0x1ff, 0x01, 0x10a, 0x148.

When the test program works, the new lcd compatibility mode should work too. The test program doesn't set MADCTL anymore, so it's still 240x320.

@Vogtinator
Copy link
Owner

By calling a different function for sending commands over SPI, the issues on HW-AA+ should be fixed now, please try: ndless-nspire/Ndless#202 (comment)

@fghsgh
Copy link

fghsgh commented Mar 7, 2020

It works! Runs very smoothly. It only freezes now when I press L to load a savestate. I left it on for 15 minutes, but it didn't respond to any keypresses and had to reset again.
EDIT: maybe the savestate didn't work because of the downgrade. New savestates are working correctly.

@Led1-ch
Copy link

Led1-ch commented Mar 9, 2020

It works wonderfully for me (the original gpsp on compatibility mode). It runs much more closely to pre HW W speed! But there is a slight issue with a thin blue line on the left side of the home screen of the calculator.

@Vogtinator
Copy link
Owner

This now restores registers better, please try: ndless-nspire/Ndless#202 (comment)

@Led1-ch
Copy link

Led1-ch commented Mar 10, 2020

It works great! Thank you so much for these updates, everything is running smoothly. I also noticed that for some games turning off the music speeds up the game a lot.

@Vogtinator
Copy link
Owner

Let's just call this issue fixed then. I'm still hopeful that GPSP can be made to work natively on 240x320, but for now this is good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants