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
128 stars 14 forks source link

[MJWMUT] Mutants! - Crashes on 2nd initialization #246

Closed tuday2 closed 3 years ago

tuday2 commented 3 years ago

Module Information

Describe the bug The 2nd time the game loads it crashes with Divide by Zero error

To Reproduce Steps to reproduce the behavior:

  1. Load Mutants!
  2. Shutdown BBS, or run nightly cleanup
  3. See error

Expected behavior Ability to load game

Screenshots

AUDIT SUMMARY: Mutants V3.15
AUDIT DETAIL: Mutants V3.15
Unhandled exception. System.DivideByZeroException: Attempted to divide by zero.
   at MBBSEmu.CPU.CpuCore.Op_Div_16()
   at MBBSEmu.CPU.CpuCore.Tick()
   at MBBSEmu.HostProcess.ExecutionUnits.ExecutionUnit.Execute(IntPtr16 entryPoint, UInt16 channelNumber, Boolean simulateCallFar, Boolean bypassState, Queue`1 initialStackValues, UInt16 initialStackPointer)
   at MBBSEmu.Module.MbbsModule.Execute(IntPtr16 entryPoint, UInt16 channelNumber, Boolean simulateCallFar, Boolean bypassSetState, Queue`1 initialStackValues, UInt16 initialStackPointer)
   at MBBSEmu.HostProcess.MbbsHost.AddModule(MbbsModule module)
   at MBBSEmu.HostProcess.MbbsHost.Start(List`1 moduleConfigurations)
   at MBBSEmu.HostProcess.MbbsHost.DoNightlyCleanup()
   at MBBSEmu.HostProcess.MbbsHost.ProcessNightlyCleanup()
   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 where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Software Information:

tuday2 commented 3 years ago

Side Note: If you delete bbsgen.db & bbsusr.db it will load correctly the 2nd time

AUDIT SUMMARY: Mutants V3.15 AUDIT DETAIL: Mutants V3.15 ---CRASHES HERE--- AUDIT SUMMARY: Mutantlink ID created. AUDIT DETAIL: Mutantlink ID Created (ML) AUDIT SUMMARY: Mutantlink disabled: IDPASS AUDIT DETAIL: Mutantlink ID Password incorrect

tuday2 commented 3 years ago

Capture from initial run in debug

2020-11-01 13:59:57.5368 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "" (5 bytes) from 1000:A55F to 000B:0B1B
2020-11-01 13:59:57.5368 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.numopt Retrieved option 63 value: 120
2020-11-01 13:59:57.5581 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stgopt Retrieved option 64 string value: 1 bytes saved to 1000:A561
2020-11-01 13:59:57.5581 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "" (20 bytes) from 1000:A561 to 000B:0DC7
2020-11-01 13:59:57.5581 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.setbtv Setting current Btrieve file to BBSUSR.DAT (3001:0000)

------------------THIS IS WHERE IT CRASHES------------------

2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "Ml" (30 bytes) from 000B:13F6 to 0000:FD20
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "☻happy☻" (10 bytes) from 000B:1485 to 0000:FD3E
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "Mutant-Link ID" (30 bytes) from 000B:148D to 0000:FD48
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "Do not delete this user." (30 bytes) from 000B:149C to 0000:FD66
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "This account is used for" (30 bytes) from 000B:14B5 to 0000:FD84
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "Mutantlink!" (30 bytes) from 000B:14CE to 0000:FDA2
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "  " (30 bytes) from 000B:14DA to 0000:FDC0
2020-11-01 13:59:57.5841 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.stzcpy Copied "  " (16 bytes) from 000B:14DA to 0000:FDDE
2020-11-01 13:59:57.5998 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.today Returned packed date: 20833
2020-11-01 13:59:57.6358 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.dinsbtv Inserted Btrieve record at 1 with 338 bytes
2020-11-01 14:01:40.6509 Info MBBSEmu.HostProcess.ExportedModules.Majorbbs.nkyrec New Key Record: Ml

Related to #146 , we stubbed out nkyrec()

tuday2 commented 3 years ago

The user is being created

Screenshot 2020-11-01 144047