mbbsemu / MBBSEmu

The MajorBBS Emulation Project is an Open Source, Cross-Platform emulator for easily running The MajorBBS & Worldgroup Modules
https://www.mbbsemu.com
MIT License
126 stars 14 forks source link

MBMGEMP Module crashing and odd issues #488

Open drcrimzon opened 3 years ago

drcrimzon commented 3 years ago

On a fresh 050321 build, MBMGEMP load successfully, and you can enter the game. When you enter, a new user is placed incorrectly, and the game crashes when trying to navigate, and does not allow movement.

The system log at load:

2021-05-24 16:16:11.8258 Info MBBSEmu.Module.MbbsModule.LoadModuleDll Loaded MBMGEMP
2021-05-24 16:16:11.8487 Debug MBBSEmu.Module.MsgFile..ctor (MBMGEHLP) Compiling MCV from MBMGEHLP.MSG
2021-05-24 16:16:11.8692 Debug MBBSEmu.Module.MsgFile..ctor (MBMGEMSG) Compiling MCV from MBMGEMSG.MSG
2021-05-24 16:16:11.8837 Debug MBBSEmu.Module.MsgFile..ctor (MBMGESHP) Compiling MCV from MBMGESHP.MSG
2021-05-24 16:16:11.9385 Debug MBBSEmu.Module.MbbsModule..ctor (MBMGEMP) Located _INIT__: 0003:0000
2021-05-24 16:16:11.9489 Info MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP) Adding Module...
2021-05-24 16:16:11.9890 Info MBBSEmu.HostProcess.ExportedModules.Galgsbl..ctor MBMGEMP Found Module Specific BTURNO # -
- Setting BTURNO to: 00000000
2021-05-24 16:16:12.1900 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:1) Segment 2 (4343 bytes) loa
ded!
2021-05-24 16:16:12.2308 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:2) Segment 3 (23063 bytes) lo
aded!
2021-05-24 16:16:12.2409 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:3) Segment 4 (21479 bytes) lo
aded!
2021-05-24 16:16:12.2652 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:4) Segment 5 (51422 bytes) lo
aded!
2021-05-24 16:16:12.2699 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:5) Segment 6 (6209 bytes) loa
ded!
2021-05-24 16:16:12.2699 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:6) Segment 7 (4264 bytes) loa
ded!
2021-05-24 16:16:12.2699 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:7) Segment 8 (9371 bytes) loa
ded!
2021-05-24 16:16:12.2893 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:8) Segment 9 (4715 bytes) loa
ded!
2021-05-24 16:16:12.2893 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:9) Segment 10 (8863 bytes) lo
aded!
2021-05-24 16:16:12.2893 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:10) Segment 11 (913 bytes) lo
aded!
2021-05-24 16:16:12.2893 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:11) Segment 12 (4432 bytes) l
oaded!
2021-05-24 16:16:12.2893 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:12) Segment 13 (578 bytes) lo
aded!
2021-05-24 16:16:12.3026 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:13) Segment 14 (392 bytes) lo
aded!
2021-05-24 16:16:12.3026 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:14) Segment 15 (1208 bytes) l
oaded!
2021-05-24 16:16:12.3026 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:15) Segment 16 (86 bytes) loa
ded!
2021-05-24 16:16:12.3026 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:16) Segment 17 (252 bytes) lo
aded!
2021-05-24 16:16:12.3026 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:17) Segment 18 (36 bytes) loa
ded!
2021-05-24 16:16:12.3208 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:18) Segment 19 (67 bytes) loa
ded!
2021-05-24 16:16:12.3208 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:19) Segment 20 (24 bytes) loa
ded!
2021-05-24 16:16:12.3208 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:20) Segment 21 (128 bytes) lo
aded!
2021-05-24 16:16:12.3208 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:21) Segment 22 (13 bytes) loa
ded!
2021-05-24 16:16:12.3338 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:22) Segment 23 (16 bytes) loa
ded!
2021-05-24 16:16:12.3338 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:23) Segment 24 (12 bytes) loa
ded!
2021-05-24 16:16:12.3338 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:24) Segment 25 (14 bytes) loa
ded!
2021-05-24 16:16:12.3338 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:25) Segment 26 (12 bytes) loa
ded!
2021-05-24 16:16:12.3338 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:26) Segment 27 (18 bytes) loa
ded!
2021-05-24 16:16:12.3513 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:27) Segment 28 (160 bytes) lo
aded!
2021-05-24 16:16:12.3513 Debug MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP:MBMGEMP.DLL:28) Segment 29 (0 bytes) load
ed!
2021-05-24 16:16:12.3513 Debug MBBSEmu.Module.MbbsModule.Execute (MBMGEMP) Exhausted execution Units, creating additiona
l
2021-05-24 16:16:12.4192 Debug MBBSEmu.Module.MsgFile..ctor (MBMGEMSG) Compiling MCV from MBMGEMSG.MSG
2021-05-24 16:16:12.5523 Debug MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB c:\MBBSEMU\MBMGEMP\MBMG
ESHP.DB
2021-05-24 16:16:12.5523 Debug MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB c:\MBBSEMU\MBMGEMP\MBMG
EMAL.DB
2021-05-24 16:16:12.5813 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.5856 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.5856 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 2 in Real-
Mode memory at 2001:0000
2021-05-24 16:16:12.5856 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.5856 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6008 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6008 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 28 in Real
-Mode memory at 2002:0000
2021-05-24 16:16:12.6008 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6008 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6133 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6133 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 198 in Rea
l-Mode memory at 2003:0000
2021-05-24 16:16:12.6133 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6133 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6133 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6292 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 512 in Rea
l-Mode memory at 2004:0000
2021-05-24 16:16:12.6292 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6292 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6292 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6292 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 13 in Real
-Mode memory at 2005:0000
2021-05-24 16:16:12.6460 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6460 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6460 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6460 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 10 in Real
-Mode memory at 2006:0000
2021-05-24 16:16:12.6460 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6697 Debug MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB c:\MBBSEMU\MBMGEMP\MBMG
EPLT.DB
2021-05-24 16:16:12.6772 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6772 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6772 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 64 in Real
-Mode memory at 2007:0000
2021-05-24 16:16:12.6772 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6914 Error MBBSEmu.Memory.ProtectedModeMemoryCore.Free Attempted to deallocate memory from an unknow
n segment 2005:0000
2021-05-24 16:16:12.6914 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6914 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.6914 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 665 in Rea
l-Mode memory at 2008:0000
2021-05-24 16:16:12.6914 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7160 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7160 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7234 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 31 in Real
-Mode memory at 2009:0000
2021-05-24 16:16:12.7234 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7749 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7749 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7749 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 198 in Rea
l-Mode memory at 200A:0000
2021-05-24 16:16:12.7749 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7892 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7892 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.7892 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 255 in Rea
l-Mode memory at 200B:0000
2021-05-24 16:16:12.7892 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.8042 Debug MBBSEmu.Btrieve.BtrieveFileProcessor.LoadSqlite Opening sqlite DB c:\MBBSEMU\MBMGEMP\MBMG
EUSR.DB
2021-05-24 16:16:12.8042 Warn MBBSEmu.CPU.CpuCore.Op_In Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.8042 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.8180 Debug MBBSEmu.HostProcess.ExportedModules.Phapi.DosAllocRealSeg (MBMGEMP) Allocating 31 in Real
-Mode memory at 200C:0000
2021-05-24 16:16:12.8180 Warn MBBSEmu.CPU.CpuCore.Op_Out Attempted access of unimplemented IO Port: 33
2021-05-24 16:16:12.8317 Debug MBBSEmu.Module.MsgFile..ctor (MBMGEHLP) Compiling MCV from MBMGEHLP.MSG
2021-05-24 16:16:12.8698 Debug MBBSEmu.HostProcess.ExportedModules.Majorbbs.pltile (MBMGEMP) Allocated base 200D:0000 fo
r 11985 bytes (376 segments)
2021-05-24 16:16:12.8698 Debug MBBSEmu.HostProcess.ExportedModules.Majorbbs.pltile (MBMGEMP) Allocated base 2186:0000 fo
r 24158 bytes (376 segments)
2021-05-24 16:16:12.8835 Debug MBBSEmu.Module.MsgFile..ctor (MBMGESHP) Compiling MCV from MBMGESHP.MSG
AUDIT SUMMARY: Galactic Empire 3.2e
AUDIT DETAIL: Galactic Empire 3.2e
AUDIT SUMMARY: Registration # 00000000
AUDIT DETAIL: Registration # 00000000
2021-05-24 16:16:13.0556 Info MBBSEmu.HostProcess.MbbsHost.AddModule (MBMGEMP) Module Added!
2021-05-24 16:16:13.1458 Info MBBSEmu.Program.Run Telnet listening on IP 0.0.0.0 port 2023
2021-05-24 16:16:13.1458 Info MBBSEmu.Program.Run Rlogin listening on IP 0.0.0.0 port 2513
2021-05-24 16:16:13.1458 Info MBBSEmu.Program.Run Rlogin MBMGEMP listening on port 2514
2021-05-24 16:16:13.1458 Info MBBSEmu.Program.Run Started MBBSEmu Build #050321-1

Starting position, note the galactic position should be X:0 Y:0

>rep nav

Interceptor: The  <NO NAME>
--------------------------------------
Navigational Report
Navigating SS# 12 12
Speed..................Warp 0.00
Galactic Heading.......  3
Galactic Pos. Xsect:12 Ysect:12
Sector Pos. X:24937 Y:24937
--------------------------------------      `

The game will not let the player move around, at all, and the heading should be 0-360, but reports 14,592

Hailing message from the Enforcer Planet
<Sector is a Neutral Zone, any hostilities will be dealt with severely!>

imp 99
Helm Reports Engines Firing - Ship coming to 14592 degrees
>***
Helm reports we are now heading 14592 degrees.
***
Helm reports speed is now Warp 0.99, Sir!
***
WARNING! Navagation beyond the Galactic Perimeter is not permitted. Engines
shut down under emergency procedures.
***
Damage control reports light damage to all sections due to kenetic shock.

***
WARNING! Navagation beyond the Galactic Perimeter is not permitted. Engines
shut down under emergency procedures.
***
Damage control reports light damage to all sections due to kenetic shock.   `

If you try to get a heading / direction to sector 0 0, the game crashes with the following:

Unhandled exception. System.ArgumentException: Destination is too short. (Parameter 'destination')
   at MBBSEmu.Memory.AbstractMemoryCore.SetArray(UInt16 segment, UInt16 offset, ReadOnlySpan`1 array)
   at MBBSEmu.CPU.CpuCore.Op_Fst()
   at MBBSEmu.CPU.CpuCore.Tick()
   at MBBSEmu.HostProcess.ExecutionUnits.ExecutionUnit.Execute(FarPtr entryPoint, UInt16 channelNumber, Boolean simulate
CallFar, Boolean bypassState, Queue`1 initialStackValues, UInt16 initialStackPointer)
   at MBBSEmu.Module.MbbsModule.Execute(FarPtr entryPoint, UInt16 channelNumber, Boolean simulateCallFar, Boolean bypass
SetState, Queue`1 initialStackValues, UInt16 initialStackPointer)
   at MBBSEmu.HostProcess.MbbsHost.WorkerThread()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
state)
   at System.Threading.ThreadHelper.ThreadStart()
tuday2 commented 3 years ago

@drcrimzon Working on troubleshooting this, what is the command to "get a heading to 0,0" that is causing the crash?

drcrimzon commented 3 years ago

nav 0 0

tuday2 commented 3 years ago

nav 0 0

Thank you @drcrimzon -- If I first enter game and type "nav 0 0" it does not crash, but entering "imp 99" first which seems to throw us out of the galaxy (which obviously is a big issue) then doing "nav 0 0" crashes

Thank you this is very helpful, will continue debugging.

enusbaum commented 1 year ago

This might have been fixed by #575, since MBMGEMP relies a TON on floating point math to calculate sectors and distances. If those floating point variables were local (stack vs. saved to a data segment), they were being written to the data segment at the offset of the stack address, which could not only corrupt memory but result in an invalid/uninitialized value on the stack for the floating point value.

Needs to be checked.