Px68k-libretro

Hello @rtype

I try to compile core in raspbian for raspberry but it’s doesn’t work, why ?

I tried theses commandes :

sudo make -f Makefile.libretro platform=crosspi sudo make -f Makefile.libretro

same errors

sudo make -f Makefile.libretro 
g++ -c -o fmgen/file.o fmgen/file.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/fmg_wrap.o fmgen/fmg_wrap.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/fmgen.o fmgen/fmgen.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/fmtimer.o fmgen/fmtimer.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/opm.o fmgen/opm.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/opna.o fmgen/opna.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o fmgen/psg.o fmgen/psg.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
g++ -c -o libretro/winx68k.o libretro/winx68k.cpp -g -O2  -fno-merge-constants  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -fpermissive 
cc -c -o x68k/d68k.o x68k/d68k.c -g -O2  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -std=gnu99 
cc -c -o m68000/m68000.o m68000/m68000.c -g -O2  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -std=gnu99 
In file included from ./libretro/common.h:4:0,
                 from m68000/c68k/c68k.h:36,
                 from m68000/m68000.h:13,
                 from m68000/m68000.c:9:
./win32api/windows.h:80:0: warning: "UNUSED" redefined
 #define UNUSED(v) ((void)(v))
 ^
In file included from m68000/c68k/c68k.h:35:0,
                 from m68000/m68000.h:13,
                 from m68000/m68000.c:9:
m68000/c68k/core.h:286:0: note: this is the location of the previous definition
 #define UNUSED __attribute ((unused))
 ^
In file included from m68000/m68000.c:18:0:
m68000/m68000.c: In function ‘m68000_init’:
m68000/../x68k/memory.h:6:23: warning: passing argument 2 of ‘C68k_Set_ReadB’ from incompatible pointer type
 #define Memory_ReadB  cpu_readmem24
                       ^
m68000/m68000.c:98:27: note: in expansion of macro ‘Memory_ReadB’
     C68k_Set_ReadB(&C68K, Memory_ReadB);
                           ^
In file included from m68000/m68000.h:13:0,
                 from m68000/m68000.c:9:
m68000/c68k/c68k.h:190:9: note: expected ‘u32 (*)(const u32)’ but argument is of type ‘BYTE (*)(DWORD)’
 void    C68k_Set_ReadB(c68k_struc *cpu, C68K_READ *Func);
         ^
In file included from m68000/m68000.c:18:0:
m68000/../x68k/memory.h:7:23: warning: passing argument 2 of ‘C68k_Set_ReadW’ from incompatible pointer type
 #define Memory_ReadW  cpu_readmem24_word
                       ^
m68000/m68000.c:99:27: note: in expansion of macro ‘Memory_ReadW’
     C68k_Set_ReadW(&C68K, Memory_ReadW);
                           ^
In file included from m68000/m68000.h:13:0,
                 from m68000/m68000.c:9:
m68000/c68k/c68k.h:191:9: note: expected ‘u32 (*)(const u32)’ but argument is of type ‘WORD (*)(DWORD)’
 void    C68k_Set_ReadW(c68k_struc *cpu, C68K_READ *Func);
         ^
In file included from m68000/m68000.c:18:0:
m68000/../x68k/memory.h:10:24: warning: passing argument 2 of ‘C68k_Set_WriteB’ from incompatible pointer type
 #define Memory_WriteB  cpu_writemem24
                        ^
m68000/m68000.c:100:28: note: in expansion of macro ‘Memory_WriteB’
     C68k_Set_WriteB(&C68K, Memory_WriteB);
                            ^
In file included from m68000/m68000.h:13:0,
                 from m68000/m68000.c:9:
m68000/c68k/c68k.h:192:9: note: expected ‘void (*)(const u32,  u32)’ but argument is of type ‘void (*)(DWORD,  BYTE)’
 void    C68k_Set_WriteB(c68k_struc *cpu, C68K_WRITE *Func);
         ^
In file included from m68000/m68000.c:18:0:
m68000/../x68k/memory.h:11:24: warning: passing argument 2 of ‘C68k_Set_WriteW’ from incompatible pointer type
 #define Memory_WriteW  cpu_writemem24_word
                        ^
m68000/m68000.c:101:28: note: in expansion of macro ‘Memory_WriteW’
     C68k_Set_WriteW(&C68K, Memory_WriteW);
                            ^
In file included from m68000/m68000.h:13:0,
                 from m68000/m68000.c:9:
m68000/c68k/c68k.h:193:9: note: expected ‘void (*)(const u32,  u32)’ but argument is of type ‘void (*)(DWORD,  WORD)’
 void    C68k_Set_WriteW(c68k_struc *cpu, C68K_WRITE *Func);
         ^
cc -c -o m68000/c68k/c68k.o m68000/c68k/c68k.c -g -O2  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -std=gnu99 
In file included from ./libretro/common.h:4:0,
                 from m68000/c68k/c68k.h:36,
                 from m68000/c68k/c68k.c:35:
./win32api/windows.h:80:0: warning: "UNUSED" redefined
 #define UNUSED(v) ((void)(v))
 ^
In file included from m68000/c68k/c68k.h:35:0,
                 from m68000/c68k/c68k.c:35:
m68000/c68k/core.h:286:0: note: this is the location of the previous definition
 #define UNUSED __attribute ((unused))
 ^
cc -c -o m68000/c68k/c68kexec.o m68000/c68k/c68kexec.c -g -O2  -D__LINUX__ -DNO_MERCURY -DPX68K_VERSION=0.15 -O3 -ffast-math -fomit-frame-pointer -I. -I./libretro -I./x68k -I./fmgen -I./win32api  -DC68K_NO_JUMP_TABLE  -D__LIBRETRO__   -fPIC  -std=gnu99 
In file included from ./libretro/common.h:4:0,
                 from m68000/c68k/c68k.h:36,
                 from m68000/c68k/c68kexec.c:25:
./win32api/windows.h:80:0: warning: "UNUSED" redefined
 #define UNUSED(v) ((void)(v))
 ^
In file included from m68000/c68k/c68kexec.c:24:0:
m68000/c68k/core.h:286:0: note: this is the location of the previous definition
 #define UNUSED __attribute ((unused))
 ^

I cant look at before. Tomorrow. Btw what it the error i see only warning. Does it stick forever when compiling ? If yes you should at least crosscompil the 69kexec.c file

Pi3 has problem to build the c68kexec.c file. It is why i cross compiling this core from a pc host. But you need an arm hard float compiler setup on the pc host to build.

Maybe you can also try an cyclone build.

To enable it just edit in makefile.libretro and add at the top. CYCLONE : = 1 It should build on pi using cyclone instead of c68k I dont know if compatibility is good as cy8k.

@r-type forget, I need to be patient. It’s ok now.

L2 work in raspberry.

Pourquoi ne pas mettre le bouton start pour lancer les jeux sur le bouton start d’un joypad aussi et ajouter les credits sur select comme sur la version PSP ? Actuellement j’ai start sur le bouton A et les credits sur bouton Y

I will try cyclone tomorrow

Yes it’s a good idea :slight_smile: I cant change this today. Maybe @Tatsuya79 will have time . if not i will lookat tomorrow

I haven’t played a game which needed credits atm, I’m not sure which one you’re thinking about? But many games seem to use left+right and up+down for menus as it is configured now.

I was trying to add buttons but it seems 8 buttons pads aren’t there in the code and the only way to change things is using that JOYKEY menu which seems really limited (and not functional).

Probably better to go like DosBox and add a Retroarch mapper input mode.

I think i mean invert a and y with start and select in joystick.c code

@r-type @Tatsuya79 I play shmup games : salamander.dim Xadlak.dim Xenon 2

got the other buttons working, but tested only with SF2 (CPSF-MD config, 6buttons), not sure what other games uses more than 2 buttons.

JOY_TRG6 and JOY_TRG7 are the remaining buttons that im not sure what they are assigned to.

XM6 2.05 source code link: http://yohkai.no-ip.info/x680x0/XM6.htm

XM6 ソースコード (version 2.05) in the middle of the page. (xm6_205s.zip)

thanks , I already grab the 2.06 elsewhere and used it for bind the keyboard. that said source are win based so hard & long to port it. (not sure I’ll have time and motivation for ,maybe someone else) BTW I’m working on the X1, the predecessor. (r-type/xmil-libretro)

i can trace(some) but not able to code from scratch, i can probably test stuffs if you want to, and im sure Tatsutya does too.

right now i cannot find the equivalent of keyboard keys OPT.1 and OPT.2 which are the select and start of some games(at least for Super Mario Bros.), is this key already included?

Btw, great work porting this. now i wouldn’t have to hard time playing CV with analog sticks.

I found that 2.06 source too now. (XM6 version 2.06 ソースコード at bottom)

There’s XM8 source for the NEC PC-88 too on that page. (xm8_161.zip)

There’s this emulator too, not sure how to open the source code (for NetBSD?). I see in its release notes it integrated recent code from XM6 Type G.

OPT1 & OPT2 have been mapped to Alt and Alt Gr.

That’s the code to change in libretro/joystick.c to have a CPSF-SFC gamepad (8 buttons):

if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT))ret0 ^= JOY_RIGHT; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT))ret0 ^= JOY_LEFT; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP) )ret0 ^= JOY_UP; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN))ret0 ^= JOY_DOWN; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A) )ret0 ^= JOY_TRG2; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B) )ret0 ^= JOY_TRG1; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT))ret1 ^= JOY_TRG7; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START) )ret1 ^= JOY_TRG6; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X) )ret1 ^= JOY_TRG3; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y) )ret1 ^= JOY_TRG4; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))ret1 ^= JOY_TRG8; if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R) )ret1 ^= JOY_TRG5;

If someone can make it a core option to switch between it and current default 2 buttons pad that would be great. Not sure how to do it myself.

here is mine, fits perfect for CPSF-MD and Xbox360 layout

if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A) )ret0 ^= JOY_TRG2; = Low-Kick if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B) )ret0 ^= JOY_TRG1; = Middle-Kick if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X) )ret1 ^= JOY_TRG3; = Low-Punch if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y) )ret1 ^= JOY_TRG4; = Mid-Punch if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L))ret1 ^= JOY_TRG8; = High-Punch if (input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R) )ret1 ^= JOY_TRG5; = High-Kick

I mapped mine to retropad corresponding buttons.

The Capcom stick itself has a strange layout: L-X-R Y-B-A

So I made it for A in game menu being retropad A (which is B on an xbox standard pad, well, you know…).

edit: OK we got it working with Wertz. :slight_smile:

I was trying some random things to get the sound better without success. Then I decided to test winx68k 065 Keropi to see how it is.

It’s almost as bad as it is here! :crying_cat_face: My reference is SF2ce, especially when moving the cursor on the character select screen: there is the same kind of distortion here. XM6 Type G is just slightly better here but not by a long shot.

There is still those popping sounds here and there on Retroarch (like when calling XMB, but also on SFX).

With winx68k “switch joypad 1 & 2” option or joypad with >2 buttons don’t work. XVIMode=2 is the max (it runs at 24Mhz though), I see only CD-ROM in the SCSI panel, MIDI sound is working.

@r-type i see defines for _WIN32 and __WIN32__( in gen68k.c), although currently the core runs fine(using Win10 x64)without them, but is this something thats probably safer to be compiled rathan not? i have been using and testing with core compiled with -D_WIN32 and -D__WIN32__ and it does not seem to have caused problems.

thanks.

Yes i added these define to permit win build In the code source. They are not in makefile because mingw include them. You can unsure and see this by using gcc -v.

at least mingw cross compiler on linux

 x86_64-w64-mingw32-gcc  -dM -E -x c /dev/null|grep WIN
#define _WIN32 1
#define _WIN64 1
#define __WINT_MAX__ 0xffff
#define __WINT_MIN__ 0
#define __WIN32 1
#define __WIN64 1
#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define __SIZEOF_WINT_T__ 2
#define WIN32 1
#define WIN64 1
#define __WINT_TYPE__ short unsigned int
#define WINNT 1
#define __WIN64__ 1

ok, noted. thanks…

For people using it first time and reading the above, there’s no need to change the XVIMode and all that stuff now. You can just directly select the CPU speed and RAM amount in core options. Just enter your path in keropi/config to the place where your floppies are to select them in the F12 menu.

Found some interesting documents here. Particularly the IO Map one.

1 Like