Closed inactive123 closed 5 years ago
@twinaphex I successfully compiled on my Odroid XU4 using Oroid-RetroArena v1.1 (RetroPie fork for XU4) using lr-reicast.sh from original RetroPie repo with modified make code below:
platform=odroid ARCH=arm BOARD="ODROID-XU3" make
The SO gets created but when I load the core into retroarch (without any games), I get a segmentation fault.
/path/to/retroarch -L /path/to/reicast_libretro.so
I can be a dedicated tester for 32bit ARM Linux with some guidance.
Good news, it works now for 32bit Windows!
Performance is a bit better too (tested with Soul Calibur, same stage, same settings) -
264fps - reicast 32bit libretro 201fps - reicast 64bit libretro
Nice Work. Out of curiosity what does the _Z10 do for the bm_getcode call? For the life of me I couldn't work out why it was failing.
For future proofing it might be worth trying to come up with a better method of referencing the PC without the need for fixed address offsets but thats not important at the moment.
Nice! Does that mean it can be ported to mobile now?
_Z10bm_GetCodej
is the decorated name of bm_GetCode
Not sure why this hack
But the main problem was that the win32 exception handler wasn't installed
@flyinghead Thanks for that. Learn something new everyday
Rebuilt, using commits from today. Here's a log
Parameters:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pigaming/RetroPie/roms/dreamcast/Dolphin Blue.lst" --appendconfig /dev/shm/retroarch.cfg
/opt/retropie/supplementary/runcommand/runcommand.sh: line 1000: 2039 Segmentation fault /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pigaming/RetroPie/roms/dreamcast/Dolphin Blue.lst" --appendconfig /dev/shm/retroarch.cfg
Quick update: I believe there's an upstream issue with Naomi games on arm. Last time I tried it crashed at startup. I didn't investigate but it's probably best to test with a DC game instead of a Naomi one for now.
There has been changes upstream regarding position-independent code on arm platforms. This was needed for android mainly but it affects all arm platforms. See https://github.com/reicast/reicast-emulator/commit/5525d5dde23ee28fd0241807c955f5e3cbf03371. These changes have to be backported.
Finally support for GLES2 in the renderer is currently broken: there are syntax errors in the shaders and a couple of things missing (depth_scale uniform in particular).
After fixing all these issues (and a couple more) I got the core to start properly. However, there's a GL issue remaining with some textures missing or with a wrong color. Still investigating this one.
I backported this commit now by @flyinghead -
https://github.com/reicast/reicast-emulator/commit/c0c06ed8ffc969650ce18b70050cbd314679f091
You can find that here -
https://github.com/libretro/reicast-emulator/commit/83c57d5da19b848c5aa3a3db62940bffde224b3e
I had to add a few changes to it for GL3, since we have people like @dviola that still want a build option for GL2.x cards as well.
@flyinghead Seems to me like you can go ahead now with your ARM-related commits.
This should take care of the rendering problem: https://github.com/libretro/reicast-emulator/pull/198
Great work @flyinghead and everyone :)
Tested Crazy Taxi for Dreamcast and it loaded! Naomi games did not load.
Yeah, I think it's known about that Naomi currently has issues on ARM.
@blisstik You tested this on Odroid XU4?
@twinaphex yes on an Odroid XU4 - the DC games work but some are slow fps like Virtua Tennis 2 and Crazy Taxi. Marvel vs Capcom 2 works well and other fighting games.
Some of the following can improve performance (at the expense of graphics accuracy)-
Disabling DSP Disabling volume shadows Disabling RTT
I will also add a frameskipping core option soon.
Tested on a raspberry pi 3 running retropie (up to date) and after a short while with a black screen and no sound (I suppose the emulator is trying to boot) it exits out. Compiled the core in the raspberry pi itself using this command line:
make platform=rpi3 ARCH=arm
And this is the content of runcommand.log:
Parameters: Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pi/RetroPie/roms/dreamcast/GuiltyGearX.cdi" --appendconfig /dev/shm/retroarch.cfg [reicast]: Got size: 640 x 480. Creating dir: /home/pi/RetroPie/BIOS/dc/data context_reset. ARM VFP-Run Fast (NFP) enabled ! Linux paging: 00001000 00001000 00000FFF MAP 00800000 w/ 25165824 MAP 20000000 w/ 25165824 MAP 04000000 w/ 16777216 MAP 06000000 w/ 16777216 MAP 0C000000 w/ 0 A8 vmem reserve: base: 491B0000, aram: 691b0000, vram: 4D1B0000, ram: 551B0000 Resetting mem Mem alloc successful!Loaded /home/pi/RetroPie/BIOS/dc/dc_boot.bin as bootrom
Loaded /home/pi/RetroPie/BIOS/dc/dc_nvmem.bin as nvram
Sh4 Reset recSh4 Init Freeing fpcb readm helpers: up to 6E3F2250 Shader linking: failed to link (0 bytes), - - DEBUGBREAK!
The same game (dreamcast version of guilty gear x) works without issues on standalone reicast.
Thanks for your hard work.
@twinaphex @flyinghead @7oxicshadow
Update: I did some further testing. I realized I forgot to transfer the naomi_boot.bin into /home/pigaming/RetroPie/BIOS/dc
I launched Dolphin Blue and it WORKED!
Edit: I have not tested audio as the XU4 is connected to a monitor w/o speakers. Will update tomorrow.
@twinaphex @flyinghead
The commits from 8/11 are causing an issue on the XU4
Parameters:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pigaming/RetroPie/roms/dreamcast/Dolphin Blue.lst" --appendconfig /dev/shm/retroarch.cfg
[reicast]: Got size: 640 x 480.
Creating dir: /home/pigaming/RetroPie/BIOS/dc/data
context_reset.
ARM VFP-Run Fast (NFP) enabled !
Linux paging: 00001000 00001000 00000FFF
MAP 00800000 w/ 50331648
MAP 20000000 w/ 50331648
MAP 04000000 w/ 33554432
MAP 06000000 w/ 33554432
MAP 0C000000 w/ 0
A8
vmem reserve: base: 817A0000, aram: a17a0000, vram: 857A0000, ram: 8D7A0000
Resetting mem
Mem alloc successful!Loaded /home/pigaming/RetroPie/BIOS/dc/naomi_boot.bin as bootrom
flash/nvmem is missing, will create new file...Sh4 Reset
recSh4 Init
Freeing fpcb
readm helpers: up to B1A25250
Shader: failed to compile
0:24: S0032: no default precision defined for variable 'w'
Shader linking: failed to link
(47 bytes), - Link failed because of invalid fragment shader. -
VERTEX:
#version 300 es
#define TARGET_GL GLES3
#define pp_Gouraud 1
#define GLES2 0
#define GLES3 1
#define GL2 2
#define GL3 3
#if TARGET_GL == GL2
#define highp
#define lowp
#define mediump
#endif
#if TARGET_GL == GLES2 || TARGET_GL == GL2
#define in attribute
#define out varying
#endif
#if TARGET_GL == GL3 || TARGET_GL == GLES3
#if pp_Gouraud == 0
#define INTERPOLATION flat
#else
#define INTERPOLATION smooth
#endif
#else
#define INTERPOLATION
#endif
/* Vertex constants*/
uniform highp vec4 scale;
uniform highp vec4 depth_scale;
/* Vertex input */
in highp vec4 in_pos;
in lowp vec4 in_base;
in lowp vec4 in_offs;
in mediump vec2 in_uv;
/* output */
INTERPOLATION out lowp vec4 vtx_base;
INTERPOLATION out lowp vec4 vtx_offs;
out mediump vec2 vtx_uv;
void main()
{
vtx_base=in_base;
vtx_offs=in_offs;
vtx_uv=in_uv;
vec4 vpos=in_pos;
#if TARGET_GL != GLES2 && TARGET_GL != GL2
if (isinf(vpos.z))
vpos.w = 1.18e-38;
else
#endif
vpos.w = 1.0 / vpos.z;
#if TARGET_GL != GLES2
if (vpos.w < 0.0) {
gl_Position = vec4(0.0, 0.0, 0.0, vpos.w);
return;
}
vpos.z = vpos.w;
#else
vpos.z=depth_scale.x+depth_scale.y*vpos.w;
#endif
vpos.xy=vpos.xy*scale.xy-scale.zw;
vpos.xy*=vpos.w;
gl_Position = vpos;
}
FRAGMENT:
#version 300 es
#define TARGET_GL GLES3
#define GLES2 0
#define GLES3 1
#define GL2 2
#define GL3 3
#if TARGET_GL == GL2
#define highp
#define lowp
#define mediump
#endif
#if TARGET_GL != GLES2 && TARGET_GL != GL2
out highp vec4 FragColor;
#define gl_FragColor FragColor
#endif
uniform lowp float sp_ShaderColor;
/* Vertex input*/
void main()
{
#if TARGET_GL != GLES2
float w = gl_FragCoord.w * 100000.0;
gl_FragDepth = log2(1.0 + w) / 34.0;
#endif
gl_FragColor=vec4(0.0, 0.0, 0.0, sp_ShaderColor);
}
DEBUGBREAK!
Pull Request #201 should fix the problem
@twinaphex @flyinghead
with the latest commits raspberry pi seems to go one step further but still doesn't boot up.
Parameters:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pi/RetroPie/roms/dreamcast/GuiltyGearX.cdi" --appendconfig /dev/shm/retroarch.cfg
[reicast]: Got size: 640 x 480.
Creating dir: /home/pi/RetroPie/BIOS/dc/data
context_reset.
ARM VFP-Run Fast (NFP) enabled !
Linux paging: 00001000 00001000 00000FFF
MAP 00800000 w/ 25165824
MAP 20000000 w/ 25165824
MAP 04000000 w/ 16777216
MAP 06000000 w/ 16777216
MAP 0C000000 w/ 0
A8
vmem reserve: base: 491A0000, aram: 691a0000, vram: 4D1A0000, ram: 551A0000
Resetting mem
Mem alloc successful!Loaded /home/pi/RetroPie/BIOS/dc/dc_boot.bin as bootrom
Loaded /home/pi/RetroPie/BIOS/dc/dc_nvmem.bin as nvram
Sh4 Reset
recSh4 Init
Freeing fpcb
readm helpers: up to 6E36E250
glGetError 0x500
Shader linking: failed to link
(0 bytes), - -
VERTEX:
#define TARGET_GL GLES2
#define pp_Gouraud 1
#define GLES2 0
#define GLES3 1
#define GL2 2
#define GL3 3
#if TARGET_GL == GL2
#define highp
#define lowp
#define mediump
#endif
#if TARGET_GL == GLES2 || TARGET_GL == GL2
#define in attribute
#define out varying
#endif
#if TARGET_GL == GL3 || TARGET_GL == GLES3
#if pp_Gouraud == 0
#define INTERPOLATION flat
#else
#define INTERPOLATION smooth
#endif
#else
#define INTERPOLATION
#endif
/* Vertex constants*/
uniform highp vec4 scale;
uniform highp vec4 depth_scale;
/* Vertex input */
in highp vec4 in_pos;
in lowp vec4 in_base;
in lowp vec4 in_offs;
in mediump vec2 in_uv;
/* output */
INTERPOLATION out lowp vec4 vtx_base;
INTERPOLATION out lowp vec4 vtx_offs;
out mediump vec2 vtx_uv;
void main()
{
vtx_base=in_base;
vtx_offs=in_offs;
vtx_uv=in_uv;
vec4 vpos=in_pos;
#if TARGET_GL != GLES2 && TARGET_GL != GL2
if (isinf(vpos.z))
vpos.w = 1.18e-38;
else
#endif
vpos.w = 1.0 / vpos.z;
#if TARGET_GL != GLES2
if (vpos.w < 0.0) {
gl_Position = vec4(0.0, 0.0, 0.0, vpos.w);
return;
}
vpos.z = vpos.w;
#else
vpos.z=depth_scale.x+depth_scale.y*vpos.w;
#endif
vpos.xy=vpos.xy*scale.xy-scale.zw;
vpos.xy*=vpos.w;
gl_Position = vpos;
}
FRAGMENT:
#define TARGET_GL GLES2
#define cp_AlphaTest 1
#define pp_ClipTestMode -1
#define pp_UseAlpha 1
#define pp_Texture 0
#define pp_IgnoreTexA 0
#define pp_ShadInstr 2
#define pp_Offset 0
#define pp_FogCtrl 3
#define pp_Gouraud 1
#define pp_BumpMap 1
#define PI 3.1415926
#define GLES2 0
#define GLES3 1
#define GL2 2
#define GL3 3
#if TARGET_GL == GL2
#define highp
#define lowp
#define mediump
#endif
#if TARGET_GL == GLES3
out highp vec4 FragColor;
#define gl_FragColor FragColor
#define FOG_CHANNEL a
#elif TARGET_GL == GL3
out highp vec4 FragColor;
#define gl_FragColor FragColor
#define FOG_CHANNEL r
#else
#define in varying
#define texture texture2D
#define FOG_CHANNEL a
#endif
#if TARGET_GL == GL3 || TARGET_GL == GLES3
#if pp_Gouraud == 0
#define INTERPOLATION flat
#else
#define INTERPOLATION smooth
#endif
#else
#define INTERPOLATION
#endif
/* Shader program params*/
/* gles has no alpha test stage, so its emulated on the shader */
uniform lowp float cp_AlphaTestValue;
uniform lowp vec4 pp_ClipTest;
uniform lowp vec3 sp_FOG_COL_RAM,sp_FOG_COL_VERT;
uniform highp float sp_FOG_DENSITY;
uniform sampler2D tex,fog_table;
uniform lowp float trilinear_alpha;
/* Vertex input*/
INTERPOLATION in lowp vec4 vtx_base;
INTERPOLATION in lowp vec4 vtx_offs;
in mediump vec2 vtx_uv;
lowp float fog_mode2(highp float w)
{
highp float z = clamp(w * sp_FOG_DENSITY, 1.0, 255.9999);
highp float exp = floor(log2(z));
highp float m = z * 16.0 / pow(2.0, exp) - 16.0;
lowp float idx = floor(m) + exp * 16.0 + 0.5;
highp vec4 fog_coef = texture(fog_table, vec2(idx / 128.0, 0.75 - (m - floor(m)) / 2.0));
return fog_coef.FOG_CHANNEL;
}
void main()
{
// Clip outside the box
#if pp_ClipTestMode==1
if (gl_FragCoord.x < pp_ClipTest.x || gl_FragCoord.x > pp_ClipTest.z
|| gl_FragCoord.y < pp_ClipTest.y || gl_FragCoord.y > pp_ClipTest.w)
discard;
#endif
// Clip inside the box
#if pp_ClipTestMode==-1
if (gl_FragCoord.x >= pp_ClipTest.x && gl_FragCoord.x <= pp_ClipTest.z
&& gl_FragCoord.y >= pp_ClipTest.y && gl_FragCoord.y <= pp_ClipTest.w)
discard;
#endif
lowp vec4 color=vtx_base;
#if pp_UseAlpha==0
color.a=1.0;
#endif
#if pp_FogCtrl==3
color=vec4(sp_FOG_COL_RAM.rgb,fog_mode2(gl_FragCoord.w));
#endif
#if pp_Texture==1
{
lowp vec4 texcol=texture(tex, vtx_uv);
#if pp_BumpMap == 1
float s = PI / 2.0 * (texcol.a * 15.0 * 16.0 + texcol.r * 15.0) / 255.0;
float r = 2.0 * PI * (texcol.g * 15.0 * 16.0 + texcol.b * 15.0) / 255.0;
texcol.a = clamp(vtx_offs.a + vtx_offs.r * sin(s) + vtx_offs.g * cos(s) * cos(r - 2.0 * PI * vtx_offs.b), 0.0, 1.0);
texcol.rgb = vec3(1.0, 1.0, 1.0);
#else
#if pp_IgnoreTexA==1
texcol.a=1.0;
#endif
color *= trilinear_alpha;
#if cp_AlphaTest == 1
if (cp_AlphaTestValue>texcol.a) discard;
#endif
#endif
#if pp_ShadInstr==0
{
color=texcol;
}
#endif
#if pp_ShadInstr==1
{
color.rgb*=texcol.rgb;
color.a=texcol.a;
}
#endif
#if pp_ShadInstr==2
{
color.rgb=mix(color.rgb,texcol.rgb,texcol.a);
}
#endif
#if pp_ShadInstr==3
{
color*=texcol;
}
#endif
#if pp_Offset==1 && pp_BumpMap == 0
{
color.rgb+=vtx_offs.rgb;
if (pp_FogCtrl==1)
color.rgb=mix(color.rgb,sp_FOG_COL_VERT.rgb,vtx_offs.a);
}
#endif
}
#endif
#if pp_FogCtrl==0
{
color.rgb=mix(color.rgb,sp_FOG_COL_RAM.rgb,fog_mode2(gl_FragCoord.w));
}
#endif
#if cp_AlphaTest == 1
color.a=1.0;
#endif
//color.rgb=vec3(gl_FragCoord.w * sp_FOG_DENSITY / 128.0);
#if TARGET_GL != GLES2
float w = gl_FragCoord.w * 100000.0;
gl_FragDepth = log2(1.0 + w) / 34.0;
#endif
gl_FragColor =color;
}
DEBUGBREAK!
@Sakitoshi were you able to compile and run at this commit: 3d41e1e4baf41c3a94b6d92b4bb2ff8cd3721052 ? Or is it a regression?
@flyinghead just tested with commit 3d41e1e and nothing. tested with crazy taxi, guilty gear x and guilty gear xx ac (a naomi game). tomorrow I'll test with a fresh installation of retropie to be sure that none of my customizations are interfering, they shouldn't, but still. this is the crazy taxi log, but they all gave the same error.
Parameters:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-reicast/reicast_libretro.so --config /opt/retropie/configs/dreamcast/retroarch.cfg "/home/pi/RetroPie/roms/dreamcast/Crazy.Taxi.(U)-NBS.cdi" --appendconfig /dev/shm/retroarch.cfg
[reicast]: Got size: 640 x 480.
Creating dir: /home/pi/RetroPie/BIOS/dc/data
context_reset.
ARM VFP-Run Fast (NFP) enabled !
Linux paging: 00001000 00001000 00000FFF
MAP 00800000 w/ 25165824
MAP 20000000 w/ 25165824
MAP 04000000 w/ 16777216
MAP 06000000 w/ 16777216
MAP 0C000000 w/ 0
A8
vmem reserve: base: 49210000, aram: 69210000, vram: 4D210000, ram: 55210000
Resetting mem
Mem alloc successful!Loaded /home/pi/RetroPie/BIOS/dc/dc_boot.bin as bootrom
Loaded /home/pi/RetroPie/BIOS/dc/dc_nvmem.bin as nvram
Sh4 Reset
recSh4 Init
Freeing fpcb
readm helpers: up to 6E439250
Shader linking: failed to link
(0 bytes), - -
DEBUGBREAK!
There might be an issue with your environment then because I tested this commit on a Pi 3 and it worked for me and for others (ODROID, NES/SNES classic).
@Sakitoshi We need more context/information on that shader linking error. You might have to get a full dump of it somehow.
@flyinghead @twinaphex you were right, something is wrong with my current environment. I just compiled and tested the latest commit 7191cc4 on a fresh retropie installation and it worked fine with dreamcast and naomi games, albeit slow, but runs. guilty gear xx ac (naomi game) glitches on the first fight but having it booting up is already good enough.
@flyinghead is currently working on multithreaded GL which should hopefully considerably boost performance of reicast on ARM systems and other low powered hardware.
Wow just realised that there is reicast core for Android on the online updater now, amazing job guys! you have really outdone yourselves.
The core runs on Android but I noticed performance is a lot better on flyinghead/mymaster builds for Android from here: http://builds.reicast.com/
Is that his multithread work? It runs practically everything fullspeed, great job.
Have you enabled multithreading and restarted?
Is that a core option?
How do I enable it? Also it seems if you press home or recent apps button on Android and go back to reicast it can't resume and it will crash, I think standalone reicast for Android and fh branch recently added so that doesn't happen.
Guess I need to add NO_THREADS=0 to the Android Makefile.
Even NAOMI games run on the Android core, pretty sweet:
@Deivmsr Please file a separate bug in the RetroArch repo.
Just realised the FMVs are not showing on any game in the Android core with default settings, you can hear the sound but you get only a black screen, anyone else with this issue?
@blackman91 I experience the same issue with NFL Blitz 2001 on DC. It's at the very beginning after loading. It doesn't affect gameplay.
BTW if you experience laggy input when you enable threaded rendering on the Android reicast core, try changing poll type behaviour to early in RetroArch latency settings, that fixes it.
OK, so I think we can close this right?
@flyinghead Just out of courtesy, I will ask before assuming but if past correspondences are any indication you don't want this bounty right? If that is the case, would anybody mind if the bounty proceeds go to us (by me filing a submit claim)? The bounty money will then be spent on other things.
The people who pledged the money - you can let me know how it should be reallocated as - either you let us decide what to do with it, or you tell us some other issue/bounty it should go towards.
@twinaphex Split it with flyinghead (if he wants it) and just spend in on something you like. Like coke and hookers for example ;)
Just kidding, but for me you don't have to spend it something related to libretro/emulators or something like that.
It's nothing compared to all the work you put into this. So just take a break, buy yourself something nice or have some fun with family and friends.
But thats my opinion though :)
Yeah, I think judging by previous conversations with @flyinghead , his position on these bounties and this other stuff is clear though, so unless he had a change of mind I don't really want to press that too much. If he wants it, he can have it entirely to himself, just for the record.
So you guys just let me know indvidually how we go about reallocating this. I know what MastaG's position on this is now. That leaves @alegag and @computer28. The other bounty backer is myself.
If @flyinghead don't want to cash it, I'm fine for it to be relocated to any issue that would benefit a bounty!
I don't have any specific issue to assign it to myself tho'.
For me, as long as it is good for the project and the people that helps with it, I'm fine !
I confirm I don’t want any of this money. Please share it or spend it as you see fit.
OK, closing it then and submitting a claim.
Great work with the Android port. Why won't fh take bounties?
Why are you so cool flyinghead? :)
@MastaG and @computer28, still need you guys to accept.
@twinaphex Accepted, sorry for the delay
Related to these issues -
https://github.com/libretro/reicast-emulator/issues/11
https://github.com/libretro/reicast-emulator/issues/6
What we expect in order for this bounty to be considered fulfilled: