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

[LUNATIX] Lunatix - Crash on startup #63

Closed ryanfantus closed 3 years ago

ryanfantus commented 4 years ago

Module Information

Describe the bug

Critical Exception has occured:
System.OverflowException: Value was either too large or too small for an unsigned byte.
   at System.Number.ThrowOverflowException(TypeCode type)
   at MBBSEmu.HostProcess.ExportedModules.ExportedModuleBase.ProcessEscapeCharacters(ReadOnlySpan`1 inputSpan)
   at MBBSEmu.HostProcess.ExportedModules.ExportedModuleBase.FormatPrintf(ReadOnlySpan`1 stringToParse, UInt16 startingParameterOrdinal, Boolean isVsPrintf)
   at MBBSEmu.HostProcess.ExportedModules.Majorbbs.sprintf()
   at MBBSEmu.HostProcess.ExportedModules.Majorbbs.Invoke(UInt16 ordinal, Boolean offsetsOnly)
   at MBBSEmu.HostProcess.ExecutionUnits.ExecutionUnit.ExternalFunctionDelegate(UInt16 ordinal, UInt16 functionOrdinal)
   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.Program.Run(String[] args)

To Reproduce Steps to reproduce the behavior:

  1. Launch MBBSEmu to run Lunatix
  2. Crash at launch time, see error

Expected behavior Best case: Game runs. Worst case: Game doesn't run, but crash doesn't take down MBBSemu.

Software Information:

enusbaum commented 4 years ago

Startup crash is caused by a list of issues uncovered now that File Loading/Pathing is fixed:

  1. The current implementation of fnd1st() takes in a wildcard. Need to verify FindFile supporst wildcard, or create a FindDirectory method in the FileHelper and append the wildcard at the end to do a Directory.GetFiles()

image

  1. The fndblk struct that is passed in isn't being set. Based on looking at Lunatix, this struct is ~43 bytes in size, with the filename starting at byte 30

image

  1. Implement the fndnxt() ordinal which would find the next file from the previous fnd1st()/fndnxt(), returning 0 if there are no more matching files

image