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

PowerPC Big Endian issue???? #506

Open
gianlucarenzi1971 opened this issue Dec 28, 2017 · 103 comments

Comments

@gianlucarenzi1971
Copy link

commented Dec 28, 2017

Hello mupen64 developers,

I am sorry for noise, but I would like to know if MUPEN64PLUS has never ran on a big endian machine like mine PPC790MP Quad Core running @ 2.5Ghz.
Actually I tried to compile from sources (git clone) and it compile without any issue (only Glide64 has an error for SSE [this architecture has Altivec]). I workedaround this modifying the include at the very beginnig in:

 #ifndef NOSSE
// See https://stackoverflow.com/a/22291538
#if defined(_MSC_VER)
/* Microsoft C/C++-compatible compiler */
#include <intrin.h>
#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
/* GCC-compatible compiler, targeting x86/x86-64 */
#include <x86intrin.h>
#elif defined(__GNUC__) && defined(__ARM_NEON__)
/* GCC-compatible compiler, targeting ARM with NEON */
#include <arm_neon.h>
#elif defined(__GNUC__) && defined(__IWMMXT__)
/* GCC-compatible compiler, targeting ARM with WMMX */
#include <mmintrin.h>
#elif (defined(__GNUC__) || defined(__xlC__)) && (defined(__VEC__) || defined(__ALTIVEC__))
/* XLC or GCC-compatible compiler, targeting PowerPC with VMX/VSX */
#include <altivec.h>
#elif defined(__GNUC__) && defined(__SPE__)
/* GCC-compatible compiler, targeting PowerPC with SPE */
#include <spe.h>
#endif

and it looks like neither GCC nor Linker gives me any error. Anyway I wish to use Rice Video Driver which gave me no warning on compiling...

After launching test I see:

./mupen64plus m64p_test_rom.v64
 __  __                         __   _  _   ____  _            
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __| 
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \ 
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/ 
             |_|         http://code.google.com/p/mupen64plus/ 
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus        
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core Warning: Unknown CIC type (000000A316ADC55A)! using CIC 6102.
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: Found ROM 'Mupen64Plus', CRC ddba4de5b107004a-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 1)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: Gallium 0.4 on AMD RV730 (DRM 2.43.0 / 4.4.0-104-powerpc64-s - 3.0 Mesa 17.0.7 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Cached Interpreter
Core Error: reserved opcode: A400004C:70A4083C
Core: R4300 emulator finished.
Core Status: Rom closed.

It looks like an endianness issue to me. As looking at mips_instructions.def I can't see any endianess switch or similar. Is it suppose to be run in the BigEndian world?

It is a pity if for a simple stuff like endianness this code cannot be run in a BE Arch...

Let me know please. If you point me where I can check for any hook just to run the code in this arch, I would be glad to re-write some pieces of code... Writing code is my full-time job.

My machine is a: Apple G5 Quad Core @ 2.5Ghz w/ 8192 Mb and it is running Linux Ubuntu 16.04 LTS with gcc 6 and an ATI VideoCard PCI Express 16x ATI Radeon HD4670 (not apple powerpc compatible during bootloader) as the log states...

Best regards,
Gianluca Renzi

@bentley

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2017

Yes, I’ve seen the exact same problem: mupen64plus builds without errors on PowerPC on OpenBSD, but fails at runtime because of byteswapped (or not‐byteswapped?) instructions. Any work on fixing that would be welcomed—I haven’t had the time to look into it.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Dec 28, 2017

At this moment I have two Apple Machines (OS X on Intel, and Linux on PPC64) and in the OSX machine everything is running good (but it is a binary package). Tomorrow I will try to download and run the same code and build from the same source in the OSX side. As soon is working good, I will backtrace the first mips instruction at the calling sequence. So I will check what function is failing on the PowerPC side... I will let you up-to-date. I hope gdb is working good at OS X side. :-)

@bsmiles32

This comment has been minimized.

Copy link
Member

commented Jan 1, 2018

Dislaimer : I don't own/use any big endian machine.

There have been a substantial work done to make the core endian agnostic using some M64P_BIG_ENDIAN defines. Be sure to build all projects (core+plugins) with the BIG_ENDIAN=1 makefile variable to enable it. This work has been done to allow the emulator to run on the GC/Wii if I remember correctly [1,2].
Please report any issue you face while trying this so we can fix them.
Thanks for the interest you have in this project !

[1] http://emulatemii.com/wordpress/
[2] http://wiibrew.org/wiki/Wii64

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Jan 22, 2018

Here I am with some news: I recompiled on both machines (x86_64 running MacOS X) with the same flags as the PowerPC 64bit machine i.e: NO_ASM=1 NO_SSE=1 DEBUGGER=1 DBG_CORE=1

but for PPC BIG_ENDIAN=1 and for x86 BIG_ENDIAN=0

When run the test rom I got on the PowerPC machine:

debian@G5-desktop:~/packages/MUPEN64PLUS/test$ ./mupen64plus ./m64p_test_rom.v64 
` __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core Warning: Unknown CIC type (000000A316ADC55A)! using CIC 6102.
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: Found ROM 'Mupen64Plus', CRC ddba4de5b107004a-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 1)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD RV730 (DRM 2.43.0 / 4.4.0-109-powerpc64-smp, LLVM 5.0.0) - 3.0 Mesa 17.2.4 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Cached Interpreter
Core: init block A4000000 - A4001000
Core: init block 84000000 - 84001000
Core: NOTCOMPILED: addr = a4000040 ops = eecf3c0
Core: block recompiled (A4000040-A4000074)
Core Error: reserved opcode: A400004C:70A4083C
Core: R4300 emulator finished.
Core Status: Rom closed.
`

When running on the x86_64 MacOS X machine:

` __  __                         __   _  _   ____  _            
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __| 
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \ 
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/ 
             |_|         https://mupen64plus.org/              
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus        
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video: Using OpenGL: ATI Radeon HD 2400 OpenGL Engine - 2.1 ATI-10.4.14 : ATI Technologies Inc.
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Cached Interpreter
Core: init block A4000000 - A4001000
Core: init block 84000000 - 84001000
Core: NOTCOMPILED: addr = a4000040 ops = 11303f120
Core: block recompiled (A4000040-A40004C0)
Core: NOTCOMPILED: addr = a4000778 ops = 11303f120
Core: block recompiled (A4000778-A4000880)
Core: NOTCOMPILED: addr = a4000880 ops = 11303f120
Core: block recompiled (A4000880-A400090C)
Core: NOTCOMPILED: addr = a400090c ops = 11303f120
Core: block recompiled (A400090C-A4000980)
Core: NOTCOMPILED: addr = a4000a40 ops = 11303f120
Core: block recompiled (A4000A40-A4000AD0)
Core: init block A4000000 - A4001000
Core: init block 84000000 - 84001000
`

and the emulation runs well...

The differences are in the first line of Core:
Core: NOTCOMPILED: addr = a4000040 ops = eecf3c0
for the powerpc machine, and:
Core: NOTCOMPILED: addr = a4000040 ops = 11303f120
for the x86 machine.

I hope this can lead to a hint. I was thinking a more verbose output... :-/

Regards

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Jan 31, 2018

Sorry I did a mistake closing the issue. The problem still persists. I would like to know how to proceed further. i.e. where the Core module is loading instructions and data from the memory just to clue out why the hell the SAME ROM gives a so strange result. Afterall ops - eecf3c0 is 24bit and 11303d120 is 33bit... :-?
The architectures bus-width is the same (64bit)... O__o

Any help?

@bsmiles32

This comment has been minimized.

Copy link
Member

commented Feb 1, 2018

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Feb 3, 2018

Well, I cloned that branch over the github original version (mupen64plus-core) and recompiled it with the same makefile flags. It gives me the same error:

 ./mupen64plus m64p_test_rom.v64 
 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core Warning: Unknown CIC type (000000A316ADC55A)! using CIC 6102.
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: ROM (CRC ddba4de5b107004a-00) not found in INI file
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 1)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD RV730 (DRM 2.43.0 / 4.4.0-112-powerpc64-smp, LLVM 5.0.0) - 3.0 Mesa 17.2.4 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Cached Interpreter
Core: init block A4000000 - A4001000
Core: init block 84000000 - 84001000
Core: NOTCOMPILED: addr = a4000040 ops = eecf3c0
Core: block recompiled (A4000040-A4000074)
Core Error: reserved opcode: A400004C:70A4083C
Core: R4300 emulator finished.
Core Status: Rom closed.

Are my steps correct? If not, please tell me how to proceed.

Regards,

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Feb 3, 2018

Just a quick note on the branch for big endian machines:
Core Error: reserved opcode: A400004C:70A4083C is fetched directly from the ROM m64p_test_rom.v64. It should be useful if every opcode should be printed on the console output so just to watch what's going on the fetch unit of the CPU Core. Maybe something here?
On the x86_64 machine there is no output, but only if the code fails. It should be useful to have both type of codes on both cases: good opcode and a reserved one.

@bsmiles32 if your code is running on a MacOS X on PowerPC I suppose, looking at the Makefile you changed in your branch. But there is a little issue: the debug options added by you are valid only for macOSX not for Linux. PPC does not mean OSX.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Mar 8, 2018

@bentley Did you proceed any further?
@bsmiles32 I would like to know why the hell the BE branch you have is not running as supposed to. I would like to have more information about the reset vector, the fetching of the instructions for the core R4300. Nothing would change my mind about endianess issue here.
Can anybody help me out?

@bsmiles32

This comment has been minimized.

Copy link
Member

commented Mar 9, 2018

@gianlucarenzi1971 Sorry for the delay. There is indeed something going wrong regarding endianness:

  • MD5 computation seems OK
  • CRC computed in Core and what Rice expects for it's db seem different
  • CIC checksum is wrong
    ...
    Can you test the "be" branch (with BIG_ENDIAN=1) on a big-endian rom (.z64) not a byte-swapped (.v64) one to see if that helps.

If you need to convert between rom formats, you might be able to do so using https://www.zophar.net/utilities/n64aud/tool-n64.html (not tested).

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Mar 11, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented Mar 13, 2018

There is further testing which you can do if you can build the latest code from git. I have fixed up the console debugger and added a memory read command, so you can run the test ROM and check your results when running on a big-endian machine. Here is what I get on my x86-64 linux box:

./mupen64plus --debug m64p_test_rom.v64
...
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) mem 0xa4000040
40806800 
(dbg) mem /4x8 0xa4000040
40806800 40804800 40805800 3c08a470 25080000 8d09000c 152000ed 00000000 
27bdffe8 afb30000 afb40004 afb50008 afb6000c afb70010 3c08a470 25080000 
3c0aa3f8 3c0ba3f0 3c0ca430 258c0000 34090040 ad090004 24111f40 00000000 
2231ffff 1620fffd 00000000 ad000008 34090014 ad09000c ad000000 24110004 
(dbg) asm
mtc0 $zero,C0_CAUSE


@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented Mar 13, 2018

Here is the log with the debug option:

`./mupen64plus --emumode 0 --debug m64p_test_rom.v64 
 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 2 SDL joysticks were found.
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: N64 Controller #1: Using auto-config with SDL joystick 0 ('usb gamepad           ')
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: N64 Controller #2: Using auto-config with SDL joystick 1 ('usb gamepad           ')
Input: 2 controller(s) found, 2 plugged in and usable in the emulator
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core: Game controller 1 (Standard controller) has nothing plugged in
Core Warning: Unknown CIC type (000000A316ADC55A)! using CIC 6102.
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: Found ROM 'Mupen64Plus', CRC ddba4de5b107004a-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_SWAP_CONTROL to 0. (it's 1)
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD RV730 (DRM 2.43.0 / 4.4.0-116-powerpc64-smp, LLVM 5.0.0) - 3.0 Mesa 17.2.8 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Input Warning: Couldn't open rumble support for joystick #1
Input Warning: Couldn't open rumble support for joystick #2
Input Warning: Couldn't open rumble support for joystick #3
Input Warning: Couldn't open rumble support for joystick #4
Debugger initialized.
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) mem 0xa4000040
ffffffff 
(dbg) asm
sd $ra,-1($ra)
(dbg) mem /4x8 0xa4000040
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
(dbg) run
(dbg) Core Error: reserved opcode: A400004C:70A4083C
Core: R4300 emulator finished.
Core Status: Rom closed.`

No way, it does not work either. It seems it can not access the file itself. All 0xFF???

@gianlucarenzi

This comment has been minimized.

Copy link

commented Mar 13, 2018

Looking at the CRC for the same rom (m64p_test_rom.v64) I have found this:

MUPEN64PLUS on BigEndian:
...
Video: Found ROM 'Mupen64Plus', CRC ddba4de5b107004a-00
...

MUPEN64PLUS on LittleEndian:
...
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
...

This is CLEARLY a Endianness Issue to me:

BE = Most Significant Word (left) 0xddba4de5
LE = Most Significant Word (left) 0xe54dbadd

BE = Least Significant Word (right) 0xb107004a
LE = Least Significant Word (right) 0x4a0007b1

@gianlucarenzi

This comment has been minimized.

Copy link

commented Mar 13, 2018

The same code run in in a x86_64 machine gives:

` __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Game controller 0 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: Found ROM 'Mupen64Plus', CRC e54dbadd4a0007b1-00
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: Gallium 0.4 on NV96 - 2.1 Mesa 8.0.4 : nouveau
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Debugger initialized.
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) mem 0xa4000040
ffffffff 
(dbg) asm
sd $ra,-1($ra)
(dbg) mem /4x8 0xa4000040
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 
(dbg) run
(dbg) Core: Removing pak from controller 0
Core Status: Stopping emulation.
Core: R4300 emulator finished.
Core Status: Rom closed.
`

but when run it works as expected!

????

@richard42

This comment has been minimized.

Copy link
Member

commented Mar 14, 2018

You need to rebuild from the latest source code. I just pushed changes last night to fix this problem where the debugger returns 0xffffffff for everything. Sorry I wasn't more explicit in my earlier message; you need to rebuild the core as well as the console-ui module.

@rvangcode

This comment has been minimized.

Copy link

commented May 21, 2018

Although very far from an expert, I've taken a look at the code and it seems to me the following is happening. Since PowerPC does not have a dynarec, it will always use the "pure interpreter". If you look at the pure interpreter, it seems that as the result of some big endian logic gone wrong somewhere, the switch statement falls back to a default case (such as this one):

default: /* Major opcodes 18..19, 28..31, 50..51, 54, 58..59, 62:
	            Reserved Instructions */
		RESERVED(r4300, op);
		break;
} /* switch ((op >> 26) & 0x3F) */

Which would explain the crash with message Core Error: reserved opcode: A400004C:70A4083C as reported, since that can be one of the results of the RESERVED() macro used here.

Since there's a lot of bit shifting and jumbling going on in this section, it's likely some implicit byte order expectations crept in.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented May 21, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented May 22, 2018

No this code is fine. All of the N64 ram/rom words are stored in system memory in native byte order, so the 'op' value is correct. And this shifting and bit-masking works exactly the same regardless of storage byte order. The instruction given in the error message is 70A4083C. The top 6 bits of this value (aka major opcode) are 011100, which is 28, which is reserved according to the comment. I checked the mips r4300 instruction set document, and it does seem that there are no instructions starting with these 6 bits.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented May 22, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented May 23, 2018

I looked through all the memory code, and I'm confident that this op value should be in the machine-native byte order. If it's not, it would be due to a bug in the ROM loading. You should be able to use the debugger which is now built into mupen64plus-ui-console to print the values in memory around this address (0x70A4083C) and compare the printed values to those stored at the same address on an Intel machine.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented May 23, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented May 24, 2018

Sorry, I gave the value for the opcode, not its address. Please post the output of this command in the debugger, with the Mupen64Plus test rom:
mem /4x8 0xa4000040
I bet it's byte-swapped compared to the values that I posted above, running the same test on my x86 machine. We're probably not handling the ROM byte order correctly after loading it.

@richard42

This comment has been minimized.

Copy link
Member

commented May 27, 2018

I think I found the problem. We were always byte-swapping the ROM image after loading, but we should not do this if we're building for a big-endian machine. I just pushed a fix to the git repo; please test with the latest code and report your results.

@bsmiles32

This comment has been minimized.

Copy link
Member

commented May 27, 2018

@richard42 Did a similar fix here bsmiles32@b17db0a a few comments ago (1 Feb), but according to OP it didn't resolve it's issue...

@richard42

This comment has been minimized.

Copy link
Member

commented May 28, 2018

Well I'm pretty sure it will solve the problems that I can see from the information presented in this bug report - the byte swapped instruction opcode and CRC value from the video plugin. There may be other problems lurking, so we'll have to tackle those next.

@gianlucarenzi1971

This comment has been minimized.

Copy link
Author

commented May 28, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented May 28, 2018

The fix is here, in the trunk of mupen64plus-core (no branch).

@richard42

This comment has been minimized.

Copy link
Member

commented Oct 20, 2018

I don't know what's causing your hang up there. The function in a thread in ui-console which is supposed to be getting your keyboard input, is stuck waiting on the system call to return the key entries. I have a feeling it might be the evil pulse audio throwing a wrench in things though. Could you give it a shot using the dummy audio plugin, like this?

./mupen64plus --emumode 0 --debug --audio dummy m64p_test_rom.v64
@chzigotzky

This comment has been minimized.

Copy link

commented Oct 22, 2018

Unfortunately --audio dummy don't solve the issue. Could someone please debug on a PowerMac?

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc-linux-gnu/libthread_db.so.1".
0x0ffcea7c in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x101cfc40) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205	../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) thread apply all bt

Thread 5 (Thread 0xd619f370 (LWP 4476)):
#0  0x0ffcb6cc in __pthread_cond_wait (cond=cond@entry=0x10170490, mutex=mutex@entry=0x10170478) at pthread_cond_wait.c:186
#1  0x08ff067c in cnd_wait (mtx=0x10170478, cond=0x10170490) at ../../include/c11/threads_posix.h:155
#2  util_queue_thread_func (input=input@entry=0x10097e18) at u_queue.c:256
#3  0x08ff0290 in impl_thrd_routine (p=<optimized out>) at ../../include/c11/threads_posix.h:87
#4  0x0ffc4088 in start_thread (arg=0xd619f370) at pthread_create.c:335
#5  0x0ff03cb4 in clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:93

Thread 4 (Thread 0xd6ae0370 (LWP 4475)):
#0  0x0ffcb6cc in __pthread_cond_wait (cond=cond@entry=0x1016ff68, mutex=mutex@entry=0x1016ff50) at pthread_cond_wait.c:186
#1  0x08ff067c in cnd_wait (mtx=0x1016ff50, cond=0x1016ff68) at ../../include/c11/threads_posix.h:155
#2  util_queue_thread_func (input=input@entry=0x10171608) at u_queue.c:256
#3  0x08ff0290 in impl_thrd_routine (p=<optimized out>) at ../../include/c11/threads_posix.h:87
#4  0x0ffc4088 in start_thread (arg=0xd6ae0370) at pthread_create.c:335
#5  0x0ff03cb4 in clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:93

Thread 3 (Thread 0xd7633370 (LWP 4474)):
#0  0x0fef0648 in read () at ../sysdeps/unix/syscall-template.S:84
#1  0x0fe8b5a0 in _IO_new_file_underflow (fp=0xffa9488 <_IO_2_1_stdin_>) at fileops.c:592
#2  0x0fe8cbe0 in __GI__IO_default_uflow (fp=0xffa9488 <_IO_2_1_stdin_>) at genops.c:413
#3  0x0fe8c8c4 in __GI___uflow (fp=fp@entry=0xffa9488 <_IO_2_1_stdin_>) at genops.c:374
#4  0x0fe7b5a0 in __GI__IO_getline_info (fp=fp@entry=0xffa9488 <_IO_2_1_stdin_>, buf=buf@entry=0xd7632ac8 "", n=255, delim=delim@entry=10, 
    extract_delim=extract_delim@entry=1, eof=eof@entry=0x0) at iogetline.c:60
#5  0x0fe7b6c8 in __GI__IO_getline (fp=fp@entry=0xffa9488 <_IO_2_1_stdin_>, buf=buf@entry=0xd7632ac8 "", n=<optimized out>, delim=delim@entry=10, 
    extract_delim=extract_delim@entry=1) at iogetline.c:35
#6  0x0fe79d48 in _IO_fgets (buf=0xd7632ac8 "", n=<optimized out>, fp=0xffa9488 <_IO_2_1_stdin_>) at iofgets.c:53
#7  0x1000457c in fgets () at /usr/include/powerpc-linux-gnu/bits/stdio2.h:263
#8  debugger_loop (arg=<optimized out>) at ../../src/debugger.c:189
#9  0x0fd23c24 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#10 0x0fd6d5f4 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#11 0x0ffc4088 in start_thread (arg=0xd7633370) at pthread_create.c:335
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xd7e33370 (LWP 4473)):
#0  0x0ffcb6cc in __pthread_cond_wait (cond=0x1003d6d8, mutex=0x1003d698) at pthread_cond_wait.c:186
#1  0x0fd6e32c in SDL_CondWait () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#2  0x09fdb160 in workqueue_get_work (thread=0x1003d6b8) at ../../src/main/workqueue.c:70
#3  0x09fdb1e4 in workqueue_thread_handler (data=0x1003d6b8) at ../../src/main/workqueue.c:87
#4  0x0fd23c24 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#5  0x0fd6d5f4 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#6  0x0ffc4088 in start_thread (arg=0xd7e33370) at pthread_create.c:335
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 0xf7e68000 (LWP 4472)):
#0  0x0ffcea7c in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x101cfc40)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x101cfc40, abstime=0x0) at sem_waitcommon.c:115
#2  0x0ffcec38 in __new_sem_wait_slow (sem=0x101cfc40, abstime=0x0) at sem_waitcommon.c:282
#3  0x0fd6da58 in SDL_SemWait () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#4  0x09fe0134 in update_debugger (pc=2751463488) at ../../src/debugger/dbg_debugger.c:86
---Type <return> to continue, or q <return> to quit---
#5  0x09fb9b34 in run_pure_interpreter (r4300=0xde250d0 <g_dev>) at ../../src/device/r4300/pure_interp.c:728
#6  0x09fba030 in run_r4300 (r4300=0xde250d0 <g_dev>) at ../../src/device/r4300/r4300_core.c:136
#7  0x09f7d1cc in run_device (dev=0xde250d0 <g_dev>) at ../../src/device/device.c:252
#8  0x09fc5030 in main_run () at ../../src/main/main.c:1604
#9  0x09f72c9c in CoreDoCommand (Command=M64CMD_EXECUTE, ParamInt=0, ParamPtr=0x0) at ../../src/api/frontend.c:224
#10 0x100031e8 in main (argc=<optimized out>, argv=<optimized out>) at ../../src/main.c:1069
(gdb) 

@chzigotzky

This comment has been minimized.

Copy link

commented Oct 22, 2018

Unfortunately --audio dummy don't solve the issue. Could someone please debug on a PowerMac?

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc-linux-gnu/libthread_db.so.1".
0x0ffcea7c in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x101cfc40) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205 ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) thread apply all bt

Thread 5 (Thread 0xd619f370 (LWP 4476)):
#0 0x0ffcb6cc in __pthread_cond_wait (cond=cond@entry=0x10170490, mutex=mutex@entry=0x10170478) at pthread_cond_wait.c:186
#1 0x08ff067c in cnd_wait (mtx=0x10170478, cond=0x10170490) at ../../include/c11/threads_posix.h:155
#2 util_queue_thread_func (input=input@entry=0x10097e18) at u_queue.c:256
#3 0x08ff0290 in impl_thrd_routine (p=) at ../../include/c11/threads_posix.h:87
#4 0x0ffc4088 in start_thread (arg=0xd619f370) at pthread_create.c:335
#5 0x0ff03cb4 in clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:93

Thread 4 (Thread 0xd6ae0370 (LWP 4475)):
#0 0x0ffcb6cc in __pthread_cond_wait (cond=cond@entry=0x1016ff68, mutex=mutex@entry=0x1016ff50) at pthread_cond_wait.c:186
#1 0x08ff067c in cnd_wait (mtx=0x1016ff50, cond=0x1016ff68) at ../../include/c11/threads_posix.h:155
#2 util_queue_thread_func (input=input@entry=0x10171608) at u_queue.c:256
#3 0x08ff0290 in impl_thrd_routine (p=) at ../../include/c11/threads_posix.h:87
#4 0x0ffc4088 in start_thread (arg=0xd6ae0370) at pthread_create.c:335
#5 0x0ff03cb4 in clone () at ../sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S:93

Thread 3 (Thread 0xd7633370 (LWP 4474)):
#0 0x0fef0648 in read () at ../sysdeps/unix/syscall-template.S:84
#1 0x0fe8b5a0 in _IO_new_file_underflow (fp=0xffa9488 <IO_2_1_stdin>) at fileops.c:592
#2 0x0fe8cbe0 in __GI__IO_default_uflow (fp=0xffa9488 <IO_2_1_stdin>) at genops.c:413
#3 0x0fe8c8c4 in __GI___uflow (fp=fp@entry=0xffa9488 <IO_2_1_stdin>) at genops.c:374
#4 0x0fe7b5a0 in __GI__IO_getline_info (fp=fp@entry=0xffa9488 <IO_2_1_stdin>, buf=buf@entry=0xd7632ac8 "", n=255, delim=delim@entry=10,
extract_delim=extract_delim@entry=1, eof=eof@entry=0x0) at iogetline.c:60
#5 0x0fe7b6c8 in __GI__IO_getline (fp=fp@entry=0xffa9488 <IO_2_1_stdin>, buf=buf@entry=0xd7632ac8 "", n=, delim=delim@entry=10,
extract_delim=extract_delim@entry=1) at iogetline.c:35
#6 0x0fe79d48 in _IO_fgets (buf=0xd7632ac8 "", n=, fp=0xffa9488 <IO_2_1_stdin>) at iofgets.c:53
#7 0x1000457c in fgets () at /usr/include/powerpc-linux-gnu/bits/stdio2.h:263
#8 debugger_loop (arg=) at ../../src/debugger.c:189
#9 0x0fd23c24 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#10 0x0fd6d5f4 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#11 0x0ffc4088 in start_thread (arg=0xd7633370) at pthread_create.c:335
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 2 (Thread 0xd7e33370 (LWP 4473)):
#0 0x0ffcb6cc in __pthread_cond_wait (cond=0x1003d6d8, mutex=0x1003d698) at pthread_cond_wait.c:186
#1 0x0fd6e32c in SDL_CondWait () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#2 0x09fdb160 in workqueue_get_work (thread=0x1003d6b8) at ../../src/main/workqueue.c:70
#3 0x09fdb1e4 in workqueue_thread_handler (data=0x1003d6b8) at ../../src/main/workqueue.c:87
#4 0x0fd23c24 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#5 0x0fd6d5f4 in ?? () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#6 0x0ffc4088 in start_thread (arg=0xd7e33370) at pthread_create.c:335
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 0xf7e68000 (LWP 4472)):
#0 0x0ffcea7c in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x101cfc40)
at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1 do_futex_wait (sem=sem@entry=0x101cfc40, abstime=0x0) at sem_waitcommon.c:115
#2 0x0ffcec38 in __new_sem_wait_slow (sem=0x101cfc40, abstime=0x0) at sem_waitcommon.c:282
#3 0x0fd6da58 in SDL_SemWait () from /usr/lib/powerpc-linux-gnu/libSDL-1.2.so.0
#4 0x09fe0134 in update_debugger (pc=2751463488) at ../../src/debugger/dbg_debugger.c:86
---Type to continue, or q to quit---
#5 0x09fb9b34 in run_pure_interpreter (r4300=0xde250d0 <g_dev>) at ../../src/device/r4300/pure_interp.c:728
#6 0x09fba030 in run_r4300 (r4300=0xde250d0 <g_dev>) at ../../src/device/r4300/r4300_core.c:136
#7 0x09f7d1cc in run_device (dev=0xde250d0 <g_dev>) at ../../src/device/device.c:252
#8 0x09fc5030 in main_run () at ../../src/main/main.c:1604
#9 0x09f72c9c in CoreDoCommand (Command=M64CMD_EXECUTE, ParamInt=0, ParamPtr=0x0) at ../../src/api/frontend.c:224
#10 0x100031e8 in main (argc=, argv=) at ../../src/main.c:1069
(gdb)

@chzigotzky

This comment has been minimized.

Copy link

commented Oct 22, 2018

I had got an output after I closed the GDB.

(dbg) mem /16 0xa4000040

40806800 40804800 40805800 3c08a470 25080000 8d09000c 152000ed 00000000 27bdffe8 afb30000 afb40004 afb50008 afb6000c afb70010 3c08a470 25080000 

(dbg) asm

mfhi $zero
@chzigotzky

This comment has been minimized.

Copy link

commented Oct 22, 2018

Any hints? Maybe another test on a PowerMac helps.

@gianlucarenzi

This comment has been minimized.

Copy link

commented Oct 22, 2018

@richard42

This comment has been minimized.

Copy link
Member

commented Nov 5, 2018

Interesting. It looks like it's now reading the memory values correctly, but the assembly language decoder is not printing the correct instruction. I looked at the r4300 instruction decoder and I see that it's using C bitfields, which is not portable between big/little endian machines. Can you download and run the following test program and copy the output here:

http://mjfrazer.org/mjfrazer/bitfields/struct.c

Just build it with gcc -o test_struct ./struct.c

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 5, 2018

Hello Richard42,

Thanks a lot for your reply. I compiled your test program on my AmigaOne X1000 today. Here are the results:

./test_struct

The fields are 1, 2, 3, 4, 5.
The entire hex value is 0xcd0a
The first byte is 0xcd
The second byte is 0x0a

Cheers,
Christian

@richard42

This comment has been minimized.

Copy link
Member

commented Nov 6, 2018

Thanks for testing. I just pushed a change which should fix the instruction decoding for big-endian machines. It won't make the emulator work properly, but it should at least be able to show you the correct instructions at each memory address. Hopefully. I also did a grep to search through the whole core code base to look for other places where C struct bitfields were being used, but I didn't find any other places.

Can you update to the newest code, rebuild, and then try and step through the first few instructions and look at the disassembled code, like this?

./mupen64plus --emumode 0 --debug --audio dummy m64p_test_rom.v64
...
PC at 0xA4000040.
(dbg) asm
mtc0 $zero,C0_CAUSE
(dbg) step
PC at 0xA4000044.
(dbg) asm
mtc0 $zero,C0_COUNT
(dbg) step
PC at 0xA4000048.
(dbg) asm
mtc0 $zero,C0_COMPARE
(dbg) step
PC at 0xA400004C.
(dbg) asm
lui $t0,0xa470
(dbg) step
PC at 0xA4000050.
(dbg) asm
addiu $t0,$t0,0
(dbg) step
PC at 0xA4000054.
(dbg) asm
lw $t1,12($t0)

We never figured out what was causing the hang-up with the previous test. Maybe it won't hang this time since we're not using the "mem" command.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 6, 2018

Hi Richard42,

I was able to compile your updated sources on my AmigaOne X1000 today.

After the command "./mupen64plus --emumode 0 --debug --audio dummy m64p_test_rom.v64", I got the same results like your output.

 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
UI-Console:             Includes support for MIPS r4300 Debugger.
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: <dummy>
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core Warning: No audio plugin attached.  There will be no sound output.
Core: Using video capture backend: dummy
Core: Game controller 0 (Standard controller) has a Memory pak plugged in
Core: Game controller 1 (Standard controller) has nothing plugged in
Core: Game controller 2 (Standard controller) has nothing plugged in
Core: Game controller 3 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: ROM (CRC e54dbadd4a0007b1-00) not found in INI file
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD BARTS (DRM 2.50.0 / 4.20.0-rc1_A-EON_AmigaOne_X1000_Nemo - 3.1 Mesa 18.2.2 : X.Org
Debugger initialized.
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) asm
mtc0 $zero,C0_CAUSE
(dbg) step

PC at 0xA4000044.
(dbg) asm
mtc0 $zero,C0_COUNT
(dbg) step

PC at 0xA4000048.
(dbg) asm
mtc0 $zero,C0_COMPARE
(dbg) step

PC at 0xA400004C.
(dbg) asm
lui $t0,0xa470
(dbg) step

PC at 0xA4000050.
(dbg) asm
addiu $t0,$t0,0
(dbg) step

PC at 0xA4000054.
(dbg) asm
lw $t1,12($t0)
(dbg) 

Cheers,
Christian

@richard42

This comment has been minimized.

Copy link
Member

commented Nov 6, 2018

Awesome; we're getting somewhere. The next step is to let it run for a few instructions and see if the interpreter modifies the registers according to the instructions as it should. Here is a test case to try out:

./mupen64plus --emumode 0 --debug --audio dummy m64p_test_rom.v64
...
PC at 0xA4000040.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0                0   t1                0 
  t2                0   t3 FFFFFFFFA4000040 
  t4                0   t5                0 
  t6                0   t7                0 
  s0                0   s1                0 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FF0 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 10

PC at 0xA400006C.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1                0 
  t2                0   t3 FFFFFFFFA4000040 
  t4                0   t5                0 
  t6                0   t7                0 
  s0                0   s1                0 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) 
@chzigotzky

This comment has been minimized.

Copy link

commented Nov 7, 2018

Here you are:

Video: Using OpenGL: AMD BARTS (DRM 2.50.0 / 4.20.0-rc1_A-EON_AmigaOne_X1000_Nemo - 3.1 Mesa 18.2.2 : X.Org
Debugger initialized.
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0                0   t1                0 
  t2                0   t3 FFFFFFFFA4000040 
  t4                0   t5                0 
  t6                0   t7                0 
  s0                0   s1                0 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FF0 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 10

PC at 0xA400006C.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1                0 
  t2                0   t3 FFFFFFFFA4000040 
  t4                0   t5                0 
  t6                0   t7                0 
  s0                0   s1                0 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) 
@richard42

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

Cool, it looks like everything matches for the first few instructions. Now let's kick it up a few orders of magnitude and see how it works over a million instructions, like this:

./mupen64plus --emumode 0 --debug --audio dummy m64p_test_rom.v64
...
PC at 0xA4000040.
(dbg) step 1000

PC at 0xA400009C.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1 0000000000000040 
  t2 FFFFFFFFA3F80000   t3 FFFFFFFFA3F00000 
  t4 FFFFFFFFA4300000   t5                0 
  t6                0   t7                0 
  s0                0   s1 0000000000001DFA 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 10000

PC at 0xA40000A0.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1 0000000000000040 
  t2 FFFFFFFFA3F80000   t3 FFFFFFFFA3F00000 
  t4 FFFFFFFFA4300000   t5                0 
  t6                0   t7                0 
  s0                0   s1 00000000000010F5 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 100000

PC at 0xA4000A84.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0 000000000000003D   a1 0000000000000002 
  a2 FFFFFFFFA3F00000   a3 FFFFFFFFA0000000 
  t0 0000000000000001   t1 000000000000000A 
  t2 FFFFFFFFA3F80000   t3                0 
  t4 0000000000000002   t5 0000000000000004 
  t6 0000000020000000   t7 0000000046000040 
  s0 0000000000000002   s1                0 
  s2 000000000000000F   s3                0 
  s4 FFFFFFFFA0800000   s5 FFFFFFFFA3F0200C 
  s6 FFFFFFFFA0800000   s7                0 
  t8 0000000020000000   t9 FFFFFFFFA3F02000 
  k0 0000000000400000   k1 0000000000000001 
 $gp 0000000000000008  $sp FFFFFFFFA4001EA0 
  sB 000000000000000A  $ra FFFFFFFFA4000920 
(dbg) step 1000000

PC at 0x80000168.
(dbg) regs
General Purpose Registers:
 $r0                0  $at 0000000000000001 
  v0 FFFFFFFFFFFFFF00   v1                0 
  a0 FFFFFFFFFFFFFF00   a1 FFFFFFFFC7ED03A0 
  a2 00000000523B28B0   a3 FFFFFFFFC7ED03A0 
  t0 000000000002CEB0   t1 FFFFFFFF8011E6B0 
  t2 FFFFFFFFF8CAA3B7   t3 FFFFFFFFB2A654F2 
  t4 FFFFFFFF8ED193B4   t5 0000000000000020 
  t6 FFFFFFFFFFFFFF00   t7 0000000000000020 
  s0 000000004D768E8E   s1 FFFFFFFFA3F08000 
  s2 0000000000780000   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8 FFFFFFFFFFFFFF00   t9 000000003812FBA0 
  k0 FFFFFFFFA4300000   k1 0000000000000001 
 $gp 0000000000000008  $sp FFFFFFFFA4001FD0 
  sB FFFFFFFFA4001F90  $ra 0000000000100000 
(dbg) 
@chzigotzky

This comment has been minimized.

Copy link

commented Nov 8, 2018

Video: Using OpenGL: AMD BARTS (DRM 2.50.0 / 4.20.0-rc1_A-EON_AmigaOne_X1000_Nemo - 3.1 Mesa 18.2.2 : X.Org
Debugger initialized.
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

PC at 0xA4000040.
(dbg) step 1000

PC at 0xA400009C.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1 0000000000000040 
  t2 FFFFFFFFA3F80000   t3 FFFFFFFFA3F00000 
  t4 FFFFFFFFA4300000   t5                0 
  t6                0   t7                0 
  s0                0   s1 0000000000001DFA 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 10000

PC at 0xA40000A0.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0                0   a1                0 
  a2                0   a3                0 
  t0 FFFFFFFFA4700000   t1 0000000000000040 
  t2 FFFFFFFFA3F80000   t3 FFFFFFFFA3F00000 
  t4 FFFFFFFFA4300000   t5                0 
  t6                0   t7                0 
  s0                0   s1 00000000000010F5 
  s2                0   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8                0   t9                0 
  k0                0   k1                0 
 $gp                0  $sp FFFFFFFFA4001FD8 
  sB                0  $ra FFFFFFFFA4001550 
(dbg) step 100000 

PC at 0xA4000A84.
(dbg) regs
General Purpose Registers:
 $r0                0  $at                0 
  v0                0   v1                0 
  a0 000000000000003D   a1 0000000000000002 
  a2 FFFFFFFFA3F00000   a3 FFFFFFFFA0000000 
  t0 0000000000000001   t1 000000000000000A 
  t2 FFFFFFFFA3F80000   t3                0 
  t4 0000000000000002   t5 0000000000000004 
  t6 0000000020000000   t7 0000000046000040 
  s0 0000000000000002   s1                0 
  s2 000000000000000F   s3                0 
  s4 FFFFFFFFA0800000   s5 FFFFFFFFA3F0200C 
  s6 FFFFFFFFA0800000   s7                0 
  t8 0000000020000000   t9 FFFFFFFFA3F02000 
  k0 0000000000400000   k1 0000000000000001 
 $gp 0000000000000008  $sp FFFFFFFFA4001EA0 
  sB 000000000000000A  $ra FFFFFFFFA4000920 
(dbg) step 1000000

PC at 0x80000168.
(dbg) regs
General Purpose Registers:
 $r0                0  $at 0000000000000001 
  v0 FFFFFFFFFFFFFF00   v1                0 
  a0 FFFFFFFFFFFFFF00   a1 FFFFFFFFC7ED03A0 
  a2 00000000523B28B0   a3 FFFFFFFFC7ED03A0 
  t0 000000000002CEB0   t1 FFFFFFFF8011E6B0 
  t2 FFFFFFFFF8CAA3B7   t3 FFFFFFFFB2A654F2 
  t4 FFFFFFFF8ED193B4   t5 0000000000000020 
  t6 FFFFFFFFFFFFFF00   t7 0000000000000020 
  s0 000000004D768E8E   s1 FFFFFFFFA3F08000 
  s2 0000000000780000   s3                0 
  s4 0000000000000001   s5                0 
  s6 000000000000003F   s7                0 
  t8 FFFFFFFFFFFFFF00   t9 000000003812FBA0 
  k0 FFFFFFFFA4300000   k1 0000000000000001 
 $gp 0000000000000008  $sp FFFFFFFFA4001FD0 
  sB FFFFFFFFA4001F90  $ra 0000000000100000 
(dbg) 
@richard42

This comment has been minimized.

Copy link
Member

commented Nov 10, 2018

That is awesome. It looks like the core is really close if not perfect now. All the register values match exactly after over a million cycles. I think now you should try a bunch of different configurations with various plugins and see if you can get anything working. Try a dummy plugin for video and regular plugins for RSP and Audio and see if you can get any audio playback with various game ROMs. Try dummy for Audio and various plugins for Video and RSP and see if you can get any video frames with the test ROM.. All of these plugins might have their own endianness problems but maybe you can find a combination which shows at least something working.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 13, 2018

Unfortunately it runs only with a black screen. I tested it with the rice and arachnoid video plugin. I can't compile Glide64 plugins because they need the header 'xmmintrin.h' which doesn't exist on PowerPC (package libgcc-*-dev). Is it possible to fix the problems in the Rice plugin? How can I use a dummy plugin for video?

@richard42

This comment has been minimized.

Copy link
Member

commented Nov 14, 2018

You should be able to build the Glide64mk2 plugin by using the "NO_SSE=1" makefile flag. To use a dummy video plugin, just run the ui-console program with "--gfx dummy". Likewise, you can use a dummy audio plugin with "--audio dummy".

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

Hi Richard42,

Many thanks for your answer.

./m64p_build.sh BITS=32 NO_SSE=1

Unfortunately I get another error:

In file included from ../../src/GlideHQ/TxFilter.h:29:0,
                 from ../../src/GlideHQ/TxFilterExport.cpp:28:
../../src/GlideHQ/TxHiResCache.h:37:32: fatal error: boost/filesystem.hpp: No such file or directory
compilation terminated.
Makefile:503: recipe for target '_obj/GlideHQ/TxFilterExport.o' failed
make: *** [_obj/GlideHQ/TxFilterExport.o] Error 1

sudo apt-get install libboost-all-dev

After that I was able to compile the Glide64mk2 plugin. :-)

Unfortunately it runs only with a black screen. I tested it with the following commands:

./mupen64plus --gfx mupen64plus-video-glide64mk2.so ../MarioKart64.z64
./mupen64plus --gfx mupen64plus-video-glide64mk2.so ../MarioKart64.n64

./mupen64plus --gfx mupen64plus-video-glide64mk2.so m64p_test_rom.v64

./mupen64plus --gfx mupen64plus-video-glide64mk2.so --audio dummy ../MarioKart64.n64

UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
Core: Using full mem base
Core: Goodname: Mario Kart 64 (U) [!]
Core: Name: MARIOKART64         
Core: MD5: 3A67D9986F54EB282924FCA4CD5F6DFF
Core: CRC: 3E5055B6 2E92DA52
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 12582912 bytes (or 12 Mb or 96 Megabits)
Core: Version: 1446
Core: Manufacturer: Nintendo
Core: Country: Unknown (0x4500)
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Glide64mk2 Video Plugin' v2.5.0
UI-Console: using Audio plugin: <dummy>
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Video: opening Glide64mk2.ini

Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core Warning: No audio plugin attached.  There will be no sound output.
Core: Using video capture backend: dummy
Core: Game controller 0 (Standard controller) has a Memory pak plugged in
Core: Game controller 1 (Standard controller) has nothing plugged in
Core: Game controller 2 (Standard controller) has nothing plugged in
Core: Game controller 3 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video Warning: Could not find [IRAMRAKO 46T] section in INI file!
Video: Using TEXUMA extension.

&ConfigOpenSection is 0x795a9e4
(II) Setting video mode 640x480...
Core: Setting video mode: 640x480
packed pixels extension used
NPOT extension used
use_fbo 1
Video: InitCombine() 
Video: extensions 
Video: initialized.
Video: 

Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter
Segmentation fault (core dumped)

Cheers,
Christian

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

I have sound with BANJO TOOIE but only a black screen with the video plugins.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

I have always the following error message with the Glide64mk2 plugin:

Video Warning: Could not find [xxxxxxxxx] section in INI file!
Video: Using TEXUMA extension.

For example:

Video Warning: Could not find [teeBA elnevderutcaR] section in INI file!
Video: Using TEXUMA extension.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

And this error message with the Rice plugin:

Video: ROM (CRC xxxxxxxxxxxxxxxxxxx) not found in INI file
Video: Initializing OpenGL Device Context.

For example (BEETLE ADVENTURE RACING):

Video: ROM (CRC e58bb4d2134cb50f-53) not found in INI file
Video: Initializing OpenGL Device Context.
@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

Video Warning: Could not find [BMOBAMREU46N] section in INI file!
Video: Using TEXUMA extension.

Glide64mk2.ini:

[BOMBERMAN64E]
fb_smart = 1
fb_hires = 1

I added to the Glide64mk2.ini:

[BMOBAMREU46N]
fb_smart = 1
fb_hires = 1

The error message is gone but it doesn't solve the video issue. This rom works without any problems on x86_64.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 14, 2018

Sometimes I get corrupted graphics instead of a black screen.

@richard42

This comment has been minimized.

Copy link
Member

commented Nov 21, 2018

I noticed the obvious byte ordering problem with the ROM names from your Glide64mk2 test cases and started diagnosing that, which led me to a common pattern in this video plugin's code which only worked with little-endian machines. I have fixed that and pushed a big change. Please rebuild from the latest code and try with Glide64mk2 again.

I see a similar problem in Rice video plugin but it's going to be a bit more work to fix this one. Can you post the full console output from a run with the test ROM using Rice video?

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 21, 2018

I compiled your latest version today and your fix because of the ROM names works! :-) With Mario Kart and the Glide64mk2 plugin I have heard a sound and after that I got a black screen and then a white screen. Sometimes I have seen a corrupted graphics.

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 21, 2018

Full console output from a run with the BLAST CORPS ROM using Rice video:

christian@ubuntu:~/Downloads/n64/test$ ./mupen64plus --gfx mupen64plus-video-rice.so --audio mupen64plus-audio-sdl.so --windowed ../../../Dokumente/N64_roms/BLAST_CORPS__U___V1_0_____.V64 
 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console Error: dlopen('/usr/local/lib/libmupen64plus.so.2') failed: /usr/local/lib/libmupen64plus.so.2: cannot open shared object file: No such file or directory
UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
Core: Using full mem base
Core: Goodname: Blast Corps (U) (V1.0) [!]
Core: Name: Blast Corps         
Core: MD5: A8DFDFF49144627492DA9B0B65B91845
Core: CRC: 7C647C25 D9D901E6
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 8388608 bytes (or 8 Mb or 64 Megabits)
Core: Version: 1444
Core: Manufacturer: Nintendo
Core: Country: Unknown (0x4500)
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Using video capture backend: dummy
Core: Game controller 0 (Standard controller) has a Memory pak plugged in
Core: Game controller 1 (Standard controller) has nothing plugged in
Core: Game controller 2 (Standard controller) has nothing plugged in
Core: Game controller 3 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: ROM (CRC 257c647ce601d9d9-43) not found in INI file
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD BARTS (DRM 2.50.0 / 4.20.0-rc3_A-EON_AmigaOne_X1000_Nemo - 3.1 Mesa 18.1.2 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter
Audio: Initializing SDL audio subsystem...

@chzigotzky

This comment has been minimized.

Copy link

commented Nov 21, 2018

Full console output from a run with the test ROM using Rice video:

christian@ubuntu:~/Downloads/n64/test$ ./mupen64plus --gfx mupen64plus-video-rice.so --audio mupen64plus-audio-sdl.so --windowed m64p_test_rom.v64 
 __  __                         __   _  _   ____  _             
|  \/  |_   _ _ __   ___ _ __  / /_ | || | |  _ \| |_   _ ___ 
| |\/| | | | | '_ \ / _ \ '_ \| '_ \| || |_| |_) | | | | / __|  
| |  | | |_| | |_) |  __/ | | | (_) |__   _|  __/| | |_| \__ \  
|_|  |_|\__,_| .__/ \___|_| |_|\___/   |_| |_|   |_|\__,_|___/  
             |_|         https://mupen64plus.org/               
Mupen64Plus Console User-Interface Version 2.5.0

UI-Console Error: dlopen('/usr/local/lib/libmupen64plus.so.2') failed: /usr/local/lib/libmupen64plus.so.2: cannot open shared object file: No such file or directory
UI-Console: attached to core library 'Mupen64Plus Core' version 2.5.1
Core: Using full mem base
Core: Goodname: Mupen64Plus Demo by Marshallh (GPL)
Core: Name: Mupen64Plus         
Core: MD5: DBF04773EC2B8ADF8A94DB7E3E461138
Core: CRC: DDBA4DE5 B107004A
Core: Imagetype: .v64 (byteswapped)
Core: Rom size: 1048576 bytes (or 1 Mb or 8 Megabits)
Core: Version: 1444
Core: Manufacturer: 0
Core: Country: Demo
UI-Console Status: Cheat codes disabled.
UI-Console: using Video plugin: 'Mupen64Plus OpenGL Video Plugin by Rice' v2.5.0
UI-Console: using Audio plugin: 'Mupen64Plus SDL Audio Plugin' v2.5.0
Input: Using auto-config file at: 'InputAutoCfg.ini'
UI-Console: using Input plugin: 'Mupen64Plus SDL Input Plugin' v2.5.0
UI-Console: using RSP plugin: 'Hacktarux/Azimer High-Level Emulation RSP Plugin' v2.5.0
Input: 0 SDL joysticks were found.
Input: N64 Controller #1: Forcing default keyboard configuration
Input: Using auto-config file at: 'InputAutoCfg.ini'
Input: 1 controller(s) found, 1 plugged in and usable in the emulator
Input: Mupen64Plus SDL Input Plugin version 2.5.0 initialized.
RSP: RSP Fallback disabled !
Core: Using video capture backend: dummy
Core: Game controller 0 (Standard controller) has a Memory pak plugged in
Core: Game controller 1 (Standard controller) has nothing plugged in
Core: Game controller 2 (Standard controller) has nothing plugged in
Core: Game controller 3 (Standard controller) has nothing plugged in
Core: Using CIC type X102
Video: Disabled SSE processing.
Video: ROM (CRC e54dbadd4a0007b1-00) not found in INI file
Video: Initializing OpenGL Device Context.
Core: Setting 32-bit video mode: 640x480
Video Warning: Failed to set GL_BUFFER_SIZE to 32. (it's 24)
Video Warning: Failed to set GL_DEPTH_SIZE to 16. (it's 24)
Video: Using OpenGL: AMD BARTS (DRM 2.50.0 / 4.20.0-rc3_A-EON_AmigaOne_X1000_Nemo - 3.1 Mesa 18.1.2 : X.Org
Audio: Using resampler trivial
Audio: Initializing SDL audio subsystem...
Core: Initializing 4 RDRAM modules for a total of 8 MB
Core: Starting R4300 emulator: Pure Interpreter

@chzigotzky

This comment has been minimized.

Copy link

commented May 21, 2019

Any news? What shall I test next?

@chzigotzky

This comment has been minimized.

Copy link

commented Jul 24, 2019

Hi Richard42,

Maybe the graphics plugin doesn't work. Gerrit Goossen created a Mac OS X port of the glN64 0.4.1j graphics plugin which works on Mac OS X 10.4 Tiger PowerPC and higher. Maybe he can give us the PowerPC patch for glN64 0.4.1. What do you think?

Cheers,
Christian

@chzigotzky

This comment has been minimized.

Copy link

commented Jul 24, 2019

I wrote to Gerrit today.

Hello Gerrit,

We are trying to port Mupen64Plus to Linux PowerPC. It works except the graphics output. Did you modify the graphics plugin glN64 0.4.1 because of the big-endian architecture?

Link to the Mupen64Plus PowerPC thread: #506

It would be really great if you can help us.

BTW, is it possible to compile Sixtyforce on Linux PowerPC?

Thanks,
Christian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.