Grimrukh / soulstruct

Python tools for inspecting and modifying FromSoft games (mainly Dark Souls 1).
144 stars 16 forks source link

Linux Support? #24

Open DNDEBUG opened 11 months ago

DNDEBUG commented 11 months ago

i tried to run it but had no luck looks like there are some windows only libs being used

2goese commented 9 months ago

Yeah also tried running via WINE menu just freeze when choosing game

astrale-sharp commented 7 months ago

Hey there :)

Just tried running the editor on linux:

First problem is simple to resolve: ImportError: cannot import name 'just_fix_windows_console' from 'colorama' (/usr/lib/python3/dist-packages/colorama/__init__.py) is just a matter of guarding

https://github.com/Grimrukh/soulstruct/blob/8ab7c7035ebf7af995b1d443e7d74bec447dedaa/soulstruct/_logging.py#L10-L11

behind

import os
if if not os.name == 'posix':

However the real problems start here https://github.com/Grimrukh/soulstruct/blob/8ab7c7035ebf7af995b1d443e7d74bec447dedaa/soulstruct/dcx/oodle.py#L191

with: AttributeError: module 'ctypes' has no attribute 'WinDLL'

At this point the code is trying to load the bundled libraries dark souls (or other) is using. This class doesn't exist on linux since dynamic C libraries don't have the same standard and extension (.so).

I don't think it's possible to emulate that so I don't think direct linux support is possible, I would love to be proved wrong ofc.

My current blocker is that once starting a project and directing it to my dark souls PTDE folder, it complains that it does not seem to be unpacked (even though it is) and then exits. I'm still unsure why

astrale-sharp commented 7 months ago

Okay, after searching a bit more, here are good candidates and another attempt https://github.com/pleiszenburg/zugbruecke https://github.com/pleiszenburg/wenv

Wenv runs python through wines

❯ pip install wenv
❯ wenv version
0.5.1
# I needed to also run this commented line for some reasons
# wenv init
❯ WENV_PYTHONVERSION=3.10.0 wenv init
❯ WENV_PYTHONVERSION=3.10.0 wenv pip install colorama numpy

We need to run 3.10.0 otherwise the version is too old and we run into

soulstruct\soulstruct\_logging.py", line 24, in format
AttributeError: 'str' object has no attribute 'removesuffix'

which is a method that was introduced in python 3.9.0

Unfortunately we end up running in

    __DLL = c.WinDLL(dll_path)
File "ctypes\__init__.py", line 374, in __init__
OSError: [WinError 193] Bad EXE format for %1

Which is mysterious because this is not the file in which the error is shown

At that point I verified the integrity of my game files and unpacked them for modding again.

Then I realized this wasn't the dll being loaded, a few print statements and we see which dll is problematic. soulstruct\oo2core_6_win64.dll

Hum... Probably a wenv problem?

anyway, before I try zugbruecke let's just not load that dll and see what happens

# WARNING: Could not find `oo2core_6_win64.dll` in Soulstruct, Sekiro, or Elden Ring paths.
# You will not be able to compress/decompress Sekiro or Elden Ring files using Soulstruct.
# Call `oodle.LOAD_DLL(path)` to load the DLL from an arbitrary path.

fair but doesn't seem blocking, No graphical interface is starting, nothing's happening at that point.

Trying ❯ WENV_PYTHONVERSION=3.10.0 wenv python -m soulstruct --help we have access to soulstruct help which is very encouraging at this point.

astrale-sharp commented 7 months ago

This seems to be as far as I go with wenv since, I get no more error messages but the editor (as seen in the youtube videos) is not opening. Wondering if I'm forgetting something simple.

astrale-sharp commented 6 months ago

Using the very good protontricks_launch on the last exe, I get the following traceback

  ERROR :: 2024-04-03 13:15:00,337 :: soulstruct.base.project.window            
    :: Line  121 :: Fatal internal error encountered. Aborting startup.
Traceback (most recent call last):
  File "soulstruct\base\project\window.py", line 108, in __init__
  File "soulstruct\base\project\core.py", line 113, in __init__
  File "soulstruct\darksouls1ptde\project\core.py", line 36, in initialize_proje
ct
  File "soulstruct\base\project\core.py", line 189, in initialize_project
  File "soulstruct\base\project\core.py", line 260, in import_talk
  File "soulstruct\base\project\core.py", line 401, in import_data_from_game
  File "soulstruct\base\project\core.py", line 52, in project_method
  File "soulstruct\base\project\core.py", line 70, in data_type_action
  File "soulstruct\base\project\core.py", line 397, in import_data
  File "soulstruct\base\ezstate\talk_directory.py", line 63, in write_esp
  File "soulstruct\base\ezstate\talk_esd_bnd.py", line 98, in write_esp
  File "soulstruct\base\ezstate\esd\core.py", line 251, in write_esp
  File "soulstruct\base\ezstate\esd\core.py", line 214, in to_esp
AttributeError: 'NoneType' object has no attribute 'submodule_name'

  ERROR :: 2024-04-03 13:15:11,502 :: soulstruct                                
    :: Line  243 :: Error occurred in soulstruct.__main__: 'NoneType' object has
 no attribute 'submodule_name'
Traceback (most recent call last):
  File "soulstruct\__main__.py", line 241, in <module>
  File "soulstruct\__main__.py", line 235, in soulstruct_main
  File "soulstruct\base\project\window.py", line 108, in __init__
  File "soulstruct\base\project\core.py", line 113, in __init__
  File "soulstruct\darksouls1ptde\project\core.py", line 36, in initialize_proje
ct
  File "soulstruct\base\project\core.py", line 189, in initialize_project
  File "soulstruct\base\project\core.py", line 260, in import_talk
  File "soulstruct\base\project\core.py", line 401, in import_data_from_game
  File "soulstruct\base\project\core.py", line 52, in project_method
  File "soulstruct\base\project\core.py", line 70, in data_type_action
  File "soulstruct\base\project\core.py", line 397, in import_data
  File "soulstruct\base\ezstate\talk_directory.py", line 63, in write_esp
  File "soulstruct\base\ezstate\talk_esd_bnd.py", line 98, in write_esp
  File "soulstruct\base\ezstate\esd\core.py", line 251, in write_esp
  File "soulstruct\base\ezstate\esd\core.py", line 214, in to_esp
AttributeError: 'NoneType' object has no attribute 'submodule_name'
astrale-sharp commented 6 months ago

That's probably where I give up :innocent:

At this point it might be faster to read the code, take the core parts and do something different with it in a linux compatible way from the start

TheBeardOfTruth commented 3 months ago

I was looking at this and the issue appears to be the liboodle dependency, a quick search says that https://github.com/McSimp/linoodle might be a relevant integration/starting point?

EDIT: Additionally something like https://github.com/sehnryr/oodle-sys may be helpful?

It won't help with OS X support but it does work on linux.

EDIT2: Additionally since oodle appears to be an optional dependency (ER and Sekiro, does not appear required for DS1PtDE, DS1R, DS2, DS3, BB) it may be appropriate to make this an optional dependency and simply warn the user that oodle support is required for ER and Sekiro editing.