Discussion

Lowres-nx as a Retroarch core ?

3

Greenpilloz 2021-01-08 18:33

Hey, I was thinking of trying to compile Lowres-nx as a Retroarch core, this way all things that can run Retroarch could run Lowres games. (yeah, finally playing games on my android!)
I saw some examples of codes in C using SDL2 ported to retroarch so I guess it should be possible.
Do you think its doable?


Timo 2021-01-08 18:43

The core of LowRes NX just outputs bitmaps to show on screen and waveforms to output on the speaker, so I guess you can port it to anything. You don't even have to use the SDL2 part, if Retroarch handles video and audio differently. Don't know its API though, so I'm not sure what's the best way, but it's doable for sure.


Timo 2021-01-09 00:47

Seems there is a retroarch core of TIC-80, which is open source. Should work very similar. Might help to check it.


Greenpilloz 2021-01-09 11:35

Ok thanks, i'll have a look


G-9 2021-01-10 14:42

This means LowRes Emulator for Wii, 3DS, Switch, and more !!
They all have a port of RetroArch


Timo 2021-01-10 15:54

But I guess you still have to compile the core for all platforms. At least you wouldn't have to adjust the code for each platform though.


Greenpilloz 2021-01-17 05:02

It works ! https://github.com/timoinutilis/lowres-nx/pull/118


Timo 2021-01-17 10:13

This is very cool, thank you a lot!!

I just used RetroArch the first time on my Mac, I still have to get a little bit familiar with it. Not sure yet, if it makes sense to include the Dev Menu etc. My first guess is that RetroArch is focused on playing, not on developing, so probably it's better to keep it simple.

Before I will merge your pull request, I prefer to have it in a separate branch and have a closer look at the code.

Could you make a video of it running on Android? And maybe share it? (Twitter, YouTube,...)

This is exciting :)


G-9 2021-01-17 16:30

Preparing DevKit Pro Wii 'n 3DS ...
How did you do that !!! You are a god !


Greenpilloz 2021-01-18 11:10 (Edited)

Thanks @G-9 ! I basically just copy-pasted a bunch of code lines from many places and glued them together. Yes playing on wii or any console with possibly 2 players would be really cool ;-)

@Timo, finally I was able to get a proper makefile (see last push), and the RetroArch core should now compile on pretty much any platform ! I Tried on android and it works like a charm. I will try to record my screen and send it to twitter or youtube when I can.

I forked and modified https://github.com/libretro/libretro-super to set everything, it should be right for compilation on their automatic building servers. I am waiting for you to accept the fork merge (or branch creation) for submitting a pull request to them. In theory, if they accept the pull request then the core will be available online directly.

Some ideas:
* add the default tools to the source code like you did for the boot logo. (nice idea btw)
* maybe even a text editor (in .nx format) that could edit the ROM script from within the dev menu (this way the full development of roms is available from within RetroArch)
* update libretro-database with a copy of your db so posted games will have images automatically.

btw, I don't know if you noticed but RetroArch have an option to play multiplayer online !


Timo 2021-01-19 20:06

Cool, they have build servers? So just by adding it, it will compile for all platforms?

I've seen the online multiplayer in the menu, but didn't try yet. A long time ago I thought about this feature built into the iOS app, but it's too much work I think.

Do the build servers build the master branch of the cores, or can you choose one? Before I merge new stuff into master I would like it to be stable.

In any case let's focus on a pure player for the beginning (like the emscripten version for the website), without virtual disks, dev menu or config file. But games should run well, with gamepad, mouse/touch and keyboard support. This could be the first version we add officially to RetroArch (and merge into the master branch). Later we can see if we add more.

A source code editor as .nx tool is not possible by the way. Programs only have access to the binary ROM data of other programs, not the source code. Also it could not run or test programs. If at all it would make more sense to build an editor into the dev menu, but making a nice text editor is actually a lot of work.

I hope I find some time this weekend to work on LowRes NX and help with the RetroArch support.


Greenpilloz 2021-01-20 12:12 (Edited)

Yes as far as I understood they do nightly builds of libretro, libretro-database and retroarch. So as long as it's on their github it should be fine. We could maybe contact them to ask first.

Yes in theory we could specify that it should fetch the development branch but in practice I didn't manage to make it work like that (check the changes I did on the fork of https://github.com/afauroux/libretro-super with "./libretro-fetch lowresnx")

I did some more testing and the dev menu and hotkeys can be activated, no problem. However I have hard time trying to get the touchscreen/mouse to work properly: There is no mouse_up event like in SDL and I can't for the life of me understand what's wrong with my update_mouse function. Pressing dev menu buttons is not working and sometimes double or random touch events are received...

keyboard and joypad works fine on mac but on android the keyboard option is quite unusable (too small and unresponsive).

Yes I guess you are right, there are thousands of good text editor on android so there is no much point to add one into lowres.

Another thing I might need your help with, is the save-state option. There are two functions "retro_serialize" and "retro_unserialize" that allow saving the state of games in a buffer of fixed size. I guess if we copy the core->machine, and core->interpreter memory then it would be possible to save and load states at any point. This is quite cool in my opinion since many games don't have a permanent-memory saving option as it is not so easy to code.

Here's the video ;-) : https://youtu.be/INQDc6JH230


G-9 2021-01-20 12:59

SO EXCITING ILL DOWNLOAD RETROARCH RIGHT NOW YOU ARE A GOOOOOOD !!!!!!!!!!!!!!!! ๐Ÿ˜ต๐Ÿ˜๐Ÿ˜


G-9 2021-01-20 13:03

I'll send photos of Wii, 3DS (maybe), and iPad


Greenpilloz 2021-01-20 13:48

its not online yet. but if you want I can try to compile it for wii ;-)


Greenpilloz 2021-01-20 15:36

Here it is:

https://mega.nz/folder/5pFVmKgB#w81gCtpaJ_O7QshJt-nxxA

In the folder there is a core for LowResNX for android/wii/psclassic and all the featured roms with their screenshots. It would be really cool if you could test that it works fine on wii !


G-9 2021-01-20 16:37 (Edited)

EDIT : why tthe hell there is a .a file instead of a .dol

okay ill try today or saturday
(school hell noooooooooooooo)


Timo 2021-01-21 08:25

I had a look into the save state documentation, I didn't know it was also used for online multiplayer.

Serialization of the "machine" is no problem, it's really just saving the 64 kB address space, actually only the second 32kB, the ROM doesn't change anyway.

But...

The interpreter is complicated. It used dynamic memory allocation for arrays and strings (using standard c library). It might be possible to serialize it for a save state; when deserializing it would have to allocate everything again and update pointers. But for online multiplayer it would do this 60 times a second. I'm not sure if it would work at all, but at least it would be horrible performance wise.

It could be a solution to replace the dynamic memory stuff with an own system with a static block of memory. But this would be quite a big change. At the moment I don't have time for this (I'm trying to work on other projects, too).


Timo 2021-01-22 08:52

I would like to make a refactoring of the files to have SDL and RetroArch separated in a cleaner way, but still sharing common files. Also I prefer doing this in a new branch instead of "development".

The easiest way would be for me to start a new branch and just copy over your changes, instead of accepting your pull request. I hope this is ok for you? I will make sure you are credited in the files (as you wouldn't appear in the git commits).


Greenpilloz 2021-01-22 10:41

Yeah, no problems ;-) do as you please


G-9 2021-01-22 11:43

Please , core in retroarch-wii are in .dol format and i found a .a file , i don't really understand ...


Timo 2021-01-22 17:53 (Edited)

Here is my version (it's not complete yet):

https://github.com/timoinutilis/lowres-nx/tree/retroarch

I went another approach and made the LibRetro/RetroArch support completely separated from the SDL2 code to keep it simple.

And I decided to go without any extras from the SDL version:

The boot intro is still missing, but planned. In any case there are still some libretro callbacks to implement and stuff.


Greenpilloz 2021-01-22 19:52

Ok, it is way cleaner than my code ! I still got few remarks though. To answer your 2 points:

  1. I agree
  2. hmm, I would quite like to be able to use the dev menu on android too. It could be accessible via the select button or smthg and contain the default tools you ship with the native version. Btw, it only requires to import "dev_menu.h" since it doesn't rely on SDL.

other remarks:


Greenpilloz 2021-01-22 20:00 (Edited)

@G-9, have you tried to just rename the file from .a to .dol ? Do you know what is the version of RetroArch you use on the wii ?


G-9 2021-01-22 20:18 (Edited)

I will try out , thanks ;)
Hope it works

Also, the version is the same as "old" retroarch like PS2.

Some links:
https://wiibrew.org/wiki/RetroArch_Wii
https://imgur.com/46g5s


Greenpilloz 2021-01-22 21:12 (Edited)

Sorry G-9, my bad. I just saw on this page:
https://docs.libretro.com/development/retroarch/compilation/wii/
That if you need .dol files it is probably because I should compile the core together with RetroArch frontend in a .dol format...
I just tried to follow exactly what was written on this link however I got compilation errors on my mac, and I am not sure what is the problem (wrong version of devkitPro compiler is my best guess...)

edit: Wait I think I found a way
edit: Nope, it's not working still... I think I don't have the good version of programs used for the compilation. You'll have to wait for the core to be on the retroarch platform and to be compiled by them, I give up :(


Timo 2021-01-23 00:02

The boot intro will come back, I just wanted to get things working quickly.
And Iโ€™m trying to find out more details about libretro, seems there is a built in system for persistent memory.


Greenpilloz 2021-01-23 11:57

Hey, I started to talk with the guys from RetroArch on adding LowRes NX and they are thrilled about it :-) !!

https://discord.com/channels/184109094070779904/434759979095031840

But apparently I was wrong about the libretro-super. In general they moved the repository to gitlab and the way to integrate it is via some gitlab compilation scipts. I'll check it when I got time.


G-9 2021-01-23 12:30

I hope it ill work this time
I only have a 32 bit computer and Devkit Pro need 64 bit ...


Timo 2021-01-23 13:25

I just added the boot intro.

Dev Menu:
I really like the libretro support, as it allows playing NX games on many new platforms. Most interesting for me are game consoles. I see Android as a special case: Ideally it should have a native LowRes NX Coder app for development. The dev menu ist not optimized for running inside something like RetroArch. It would be additional work to adapt it and it would still be a compromise.
Personally I don't want to support this officially, but of course you could work on it in your fork.

Mouse:
Strange, on my Mac the mouse works as expected. Is this a touch screen problem?


Greenpilloz 2021-01-23 14:22 (Edited)

Mouse:
It works for like EPAINT.nx but try it on like SOUND COMPOSER and you will see the problem. (on mac with your version of the core)
* When you click on the same location several times then touchX and touchY are set to 0
* When you click on notes on the keyboard for e.g. you can see that there is actually 2 clicks or something odd like that since it's not possible to play.

Dev Menu:
As you wish. I'll do some tests on my own. If I reach a satisfying way to implement it and the LowRes core is already working fine with your version, I'll come back with a pull request. Maybe it could be activated for example only on platforms that have mouse or tactile capabilities (not so many of them).

@G-9 tkt รงa va marcher sur la wii c'est juste que j'arrive pas ร  le compiler proprement sur mon ordi. Patience ;-)


Timo 2021-01-23 14:56

Just checked with Sound Composer, everything works as expected here :O ?ยฟ?ยฟ?
The only issue is, if you just tap on a touch pad (MacBook) without really pressing it down, the click is so short, that it can be less than a frame and isn't caught by the input check.
Also I took the mouse code mostly from TIC-80 (I think you did the same, or they had the same origin...), so I guess it should be ok.
Strange!


Timo 2021-01-23 19:52

Persistent RAM almost works already... the problem is, after the boot intro it gets reset :( At least RetroArch works as expected, I just have to fix it in my code.


G-9 2021-01-24 12:16 (Edited)

What kind of compilation error there are ?
I actually know only two errors : Parse Error and Excepted [y] before [x] :)


Timo 2021-01-24 15:55

@Greenpilloz
From my side it's kind of complete (persistent RAM works, yey!). Could you check it on Android again?

Issues:

* Touch/mouse works for me but not for you. Did you try other RetroArch cores with mouse support? E.g. TIC-80? Maybe there is an issue with RetroArch itself??

* In fullscreen there is no mouse pointer. I could build one into LowRes NX and enable it via the RetroArch content options. But using the touch API I don't get movements when the user is not clicking, so alternatively the mouse API needs to be supported. Is it worth the effort? I would say... don't use fullscreen for tools...

* No virtual disk support. For the moment I'm out of motivation to implement it. Should use RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY.

* Fast-forward doesn't really work because of audio. Happens with other cores, too. No idea how to fix it.


Greenpilloz 2021-01-24 19:33 (Edited)

Ok I tested your last version on both mac and android, and everything works fine appart from the mouse/touch:

* Still I got clicks on X,Y = 0,0 on mac and on android tactile applications stop working and freeze after few clicks... I guess it is ok anyway, since most platforms on RetroArch don't have a mouse or a tactile screen. Maybe it is worth blocking tactile apps at first or displaying a warning (or nothing at all, as we could wait and see if I am the only one with such problem and fix it later)

I got two other remarks that I think you should consider before publishing:

* As I told you the path of the jni folder ("plateform/LowRes NX LibRetro/jni") cannot contain spaces otherwise the android compilation will fail (btw I think its not such a good habit to have spaces in paths). So I advice you to rename all platform folders.

* Also I got trouble with the fact that you named the object files ".bc" since the makefile for libretro is expecting (as in most makefiles) ".o" files. It could be synchronised either way but I think passing everything to ".o" is safer.

As they explained on discord we need to write a yaml compilation configuration in the following style:
https://github.com/libretro/libretro-2048/blob/master/.gitlab-ci.yml
I don't have time right now but maybe I'll have a look tmrw


Timo 2021-01-24 20:47

Pull again, you miss some commits, I renamed all folders in "platforms" and removed "LowRes NX" from them, so no more spaces :)

I would just keep the touch support as it is now. We will see if someone else complains.

I think the ".bc" files are required for my web/emscripten version. For LibRetro we can change it. Maybe for Linux, too.


Greenpilloz 2021-01-24 21:10

Oh my bad, yes I pulled too early ;)

Yeah, for the ".bc" files, it's up to you. It's just troublesome if you forget to do a "make clean" between two compilations, that's all.

I'll look into how to add the ".gitlab-ci.yml" file tomorrow (I think there is not much to do there basically), then we will see about uploading it ;-)

Also there is a way to upload some info on the games that are on your website, so they will automatically have screen captures and info about developers etc... They might even be downloadable directly from RetroArch if I understood correctly (not sure). I guess we just have to upload some json alike data files to libretro-database


DrGonzo 2021-01-27 16:37

Yay more than 1k view!

https://www.youtube.com/watch?v=YSSrGT9P_b8&feature=emb_logo


Timo 2021-01-28 08:19

Cool :)


Greenpilloz 2021-02-13 20:20

It's there ! LowRes NX and games are available for download from RetroArch !!!! :-)


G-9 2021-02-14 14:11

Where please ? (๐Ÿ˜€)


Timo 2021-02-14 18:26

Itโ€™s listed for download as a Core in RetroArch itself.


Dan 2021-02-15 12:05

For android's Retroarch, the NX core is downloadable today.


G-9 2021-02-15 17:11

Hope it will be aviable for Wii and 3DS because they doesn't handle downloads ...๐Ÿ˜…


Timo 2021-02-15 18:41 (Edited)

G-9, what do you mean? I saw a video about RetroArch on the 3DS and it looks like it has all the options. Check "Load Core" and then "Download Core"... There should be the list of available cores, hopefully with LowRes NX included.


Greenpilloz 2021-02-15 19:12 (Edited)

Otherwise you can find the lowresnx core for wii here: http://buildbot.libretro.com/nightly/nintendo/wii/latest/

and for 3DS here: http://buildbot.libretro.com/nightly/nintendo/3ds/

and download them manually and put them on your console via your usb stick or whatever method you currently use ;-)

Btw all featured games are here: http://buildbot.libretro.com/assets/cores/LowResNX/

and thumbnails here: https://github.com/libretro-thumbnails/LowRes_NX


G-9 2021-02-16 08:43 (Edited)

I'm so happy yes yes yess finally oh good job guys just lemme try :) :) :D
Actually thumbnails are not needed for "old" retroarch :)
Oh i cant download them all as a .zip ... ill download default programs :)


G-9 2021-02-16 12:17

Oh on the Wii it works okay it works but... I'm sorry but...
- The sound is horrible. I'll send a video soon
- The only working controls are the buttons. D-pad is not working and pause is not even in RetroArch's controls menu.
- Palettes don't work ...
You are not obligated to fix them, it's working so...


Greenpilloz 2021-02-16 12:40 (Edited)

Hmm damned !
- Sound: no idea why that would be. I'll be interested to see a vid yes
- d-pad: I think this should be possible to configure it correctly via the retroarch menu
- Palettes don't work: I had an issue once with that. What you mean is that the colors are not the good ones or that there are no colors ?

do you have similar problems for other cores from the wii core download page I send:
http://buildbot.libretro.com/nightly/nintendo/wii/latest/


Timo 2021-02-16 13:16

They already reported the issue with wrong palettes. Actually all the attributes are wrong (flip etc.)
I believe this is an issue with byte orders on different CPUs. The Wii used a PowerPC based CPU. I will have a look at it, but I don't know how to test it yet.


Timo 2021-02-16 13:18

And "pause" is called "start" in RetroArch, I think.


G-9 2021-02-16 16:49 (Edited)

@Timo There is only A, B, DPAD_UP, DPAD_LEFT, DPAD_RIGHT and DPAD_DOWN.
@Greenpilloz Yes colors are not the good ones , they look like the first LRNX for Gameshell I saw on Timo's twitter ... No ofc SNES9X, Gambatte and 2048 runs well, maybe a sound filter problem or idk...


G-9 2021-02-17 14:28

@Greenpilloz Here it is !


Timo 2021-02-17 17:35

Strange, sometime the colors seem correct, sometimes not.


Greenpilloz 2021-02-22 14:15 (Edited)

Thanks G-9. Looks strange indeed ! There should be a way to map a pause/start button as Timo said. How do you do for other consoles ? They all have a start button no?

I think that Timo is right, it is probably an issue with the byte order or the endianness of the wii classic console. Maybe the makefile could be changed so the compilation will work better.

Timo maybe the condition in line 237 of the video_chip.c file was only true for some platforms and the change in palette should be controlled via compilation flags.

I guess we could file an issue on the RetroArch github/lab and hope for someone more knowledgeable on the subject of compiling cores for the wii classics to help.


G-9 2021-02-28 09:21 (Edited)

@Greenpilloz

and for 3DS here: http://buildbot.libretro.com/nightly/nintendo/3ds/

For the 3DS do you mean this ?

Actually on 3DS it runs perfect but YOU NEED A NEW 3DS because old 3DS is too slow for cores :/

rip i have an old one


Timo 2021-02-28 16:08

@Greenpilloz I think that the RGB stuff is correct, because the boot intro and some sprites look right. It seems to be a problem with the attributes, so wrong palettes and even wrong flipping are used.


Log in to reply.