Skip to content

Instantly share code, notes, and snippets.

@frame
Last active September 25, 2021 06:15
Show Gist options
  • Save frame/4410ef45794417e579b3bb7b4367e65d to your computer and use it in GitHub Desktop.
Save frame/4410ef45794417e579b3bb7b4367e65d to your computer and use it in GitHub Desktop.

Lords of Xulima ICSharpCode.SharpZipLib fix

When launching Lords of Xulima 2.1.1.1352 and you're not on an en-US locale (e.g. you're using a German, Spanish or French Windows) you cannot launch the game. This error message shows up instead:

ERROR MESSAGE

 ID  1AAA7238
SO: Microsoft Windows NT 6.2.9200.0 
64 bits: True 
LOX Version: V.2.1.1 
LOX Mod: (None) 
 MESSAGE  1 is not a supported code page.
Parameter name: codepage
 SOURCE  mscorlib
 TRACE     at System.Text.Encoding.GetEncoding(Int32 codepage)
   at ICSharpCode.SharpZipLib.Zip.ZipFile.ReadEntries()
   at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor(String name)
   at DXVision.Serialization.ZipResourceManager..ctor(String filename)
   at DXVision.DXProject.LoadFromFile(String name)
   at JXApp.Windows.JXFMain.FMain_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at DXVision.DXViewerForm.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The reason for this issue is that the bundled ICSharpCode.SharpZipLib.dll version relies on a fallback locale, which isn't defined in the game: In version 1.0.0 SharpZipLib adds a fallback mechanism. Numantian Games would only need to update the DLL and re-release the game, but it's often not so simple to recompile/build older games.

Workaround

Here's a way to fix it for users:

  1. You need to download 1.0.0 of the ICSharpCode.SharpZipLib.dll: https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.0.0 - there's much newer versions available, possibly fixing other things, but I only tested 1.0.0

Ignore the Source zip, you'll need to fetch the SharpZipLib.1.0.0.nupkg

  1. You can open the SharpZipLib.1.0.0.nupkg file with 7zip. Copy the lib\netstandard2.0\ICSharpCode.SharpZipLib.dll from inside the nupkg into your game folder (you'll get a prompt to overwrite)

  2. Next, open LoX.exe.config with Notepad and replace the whole file with this:

<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true"><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
        <bindingRedirect oldVersion="0.86.0.518" newVersion="1.0.0.999" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

This change forces LoX.exe to use 1.0.0 of the DLL, which works fine.

You can copy the modified LoX.exe.config to LOXEditor.exe.config (this will create a new file) to make the Editor work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment