Commit 00759717 authored by TomaSajt's avatar TomaSajt Committed by Anderson Torres
Browse files

smb3-foundry: init at 1.2

parent 22b12ba6
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, python3
, makeWrapper
}:

let
  pythonEnv = (python3.withPackages (ps: with ps; [
    pyside6
    py65
    qdarkstyle
  ]));
in
stdenv.mkDerivation (finalAttrs: {
  pname = "smb3-foundry";
  version = "1.2";

  src = fetchFromGitHub {
    owner = "mchlnix";
    repo = "SMB3-Foundry";
    rev = "refs/tags/${finalAttrs.version}";
    hash = "sha256-iqqIyGp/sqWgShxk52omVcn7Q3WL2hK8sTLH4dashLE=";
  };

  patches = [ ./fix-relative-dirs.patch ];

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/app
    cp -R smb3parse foundry scribe data doc VERSION smb3-foundry.py smb3-scribe.py $out/app

    makeWrapper ${pythonEnv}/bin/python $out/bin/smb3-foundry \
          --add-flags "$out/app/smb3-foundry.py"
    makeWrapper ${pythonEnv}/bin/python $out/bin/smb3-scribe \
          --add-flags "$out/app/smb3-scribe.py"

    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/mchlnix/SMB3-Foundry";
    description = "A modern Super Mario Bros. 3 Level Editor";
    changelog = "https://github.com/mchlnix/SMB3-Foundry/releases/tag/${finalAttrs.version}";
    license = lib.licenses.gpl3Only;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ tomasajt ];
  };
})
+34 −0
Original line number Diff line number Diff line
diff --git a/foundry/gui/WarningList.py b/foundry/gui/WarningList.py
index ace83d7..46012df 100644
--- a/foundry/gui/WarningList.py
+++ b/foundry/gui/WarningList.py
@@ -5,6 +5,7 @@ from PySide6.QtCore import QEvent, QRect, Qt, Signal, SignalInstance
 from PySide6.QtGui import QCursor, QFocusEvent
 from PySide6.QtWidgets import QLabel, QVBoxLayout, QWidget
 
+from foundry import root_dir
 from foundry.game import GROUND
 from foundry.game.ObjectDefinitions import GeneratorType
 from foundry.game.gfx.objects import EnemyItem
@@ -216,7 +217,7 @@ class WarningList(QWidget):
         return [enemy for enemy in self.level_ref.level.enemies if enemy.type == enemy_id]
 
     def _build_enemy_clan_dict(self):
-        with open("data/enemy_data.json", "r") as enemy_data_file:
+        with open(root_dir.joinpath("data", "enemy_data.json"), "r") as enemy_data_file:
             enemy_data = json.loads(enemy_data_file.read())
 
             self._enemy_dict.clear()
diff --git a/smb3parse/util/parser/__init__.py b/smb3parse/util/parser/__init__.py
index ecef169..8bba57e 100644
--- a/smb3parse/util/parser/__init__.py
+++ b/smb3parse/util/parser/__init__.py
@@ -302,7 +302,7 @@ def gen_levels_in_rom(
 
     print("---------------------", level_count, "------------------------")
 
-    level_data = pathlib.Path("data/levels.dat")
+    level_data = pathlib.Path(__file__).parent.parent.parent.joinpath("data", "levels.dat")
 
     missing = 0
     levels: dict[int, set[int]] = defaultdict(set)
+3 −3
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ buildPythonPackage rec {
          --replace "test_argv_combination_rom_mpu" "dont_test_argv_combination_rom_mpu"
  '';

  meta = with lib; {
  meta = {
    homepage = "https://py65.readthedocs.io/";
    description = "Emulate 6502-based microcomputer systems in Python";
    longDescription = ''
@@ -33,7 +33,7 @@ buildPythonPackage rec {
      debugger. Py65Mon provides a command line with many convenient commands
      for interacting with the simulated 6502-based system.
    '';
    license = licenses.bsd3;
    maintainers = with maintainers; [ AndersonTorres tomasajt ];
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ AndersonTorres tomasajt ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -1829,6 +1829,8 @@ with pkgs;
  sorted-grep = callPackage ../tools/text/sorted-grep { };
  smb3-foundry = callPackage ../applications/misc/smb3-foundry { };
  smbmap = callPackage ../tools/security/smbmap { };
  smbscan = callPackage ../tools/security/smbscan { };