asm68k

Discussion in 'Engineering & Reverse Engineering' started by RetroKoH, Jul 20, 2014.

  1. RetroKoH

    RetroKoH

    Member
    1,661
    17
    18
    Project Sonic 8x16
    I'm trying to implement running a build batch file from Triad. While I can access cmd.exe and begin running the file, I'm getting this issue once it does that:

    'asm68k' is not recognized as an internal or external command, operable program, or batch file.
    'fixheader.exe' is not recognized as an internal or external command, operable program, or batch file.

    Any Techs understand why this is occuring?
     
  2. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,552
    146
    43
    SonLVL
    Probably because the current directory isn't set properly for the process running the batch file.
     
  3. RetroKoH

    RetroKoH

    Member
    1,661
    17
    18
    Project Sonic 8x16
    Right.

    Following this and some GML guides I found, I ended up with this code:
    Code (Text):
    1.  
    2.  
    3. builder="C:\Users\Chris\Documents\Sonic Retro\Hacking\Disassemblies\Mega Drive\Sonic 1 Disassemblies\Sonic 1 REV C (R46)\build.bat" // Builder
    4. path=filename_path(builder); // path of said file
    5. file=filename_name(builder); // filename itself
    6. execute_program(environment_get_variable("COMSPEC"), 'cd "'+path+'"',true);
    7.  

    This itself runs cmd.exe (COMSPEC). cd 'path' is an argument that is SUPPOSED to tell the cmd to redirect to the path of the builder. I'm looking into more tips on how to get this to work as it isn't doing so for me it seems
     
  4. That code doesn't do anything useful. It starts a cmd.exe process that does nothing (to run a command in cmd, you need to put it after a /c switch, or a /k switch to leave cmd running after the command ran). Even if it did something, it would have no impact on the build.bat launched later, because it only changes the current directory on the spawned process, not on your Triad process. The best suggestion I can give you is to run cmd.exe with arguments like this:

    Code (Text):
    1. /c pushd "C:\path\to" && "build.bat"
    What this does is run cmd.exe with a command that is composed of 2 subcommands: the pushd changes the current directory, and build.bat runs build.bat in that directory. (pushd has an advantage over cd: it will automatically map a network drive if the path is a UNC path.)

    So your last line would look like this:

    Code (Text):
    1. execute_program(environment_get_variable("COMSPEC"), '/c pushd "' + path + '" && "' + file + '"',true);
    EDIT: Added the missing /c as noted by KingofHarts below.
     
  5. RetroKoH

    RetroKoH

    Member
    1,661
    17
    18
    Project Sonic 8x16
    In the last line you forgot the /c but I did it in my code...
    HOLY SHIT THANK YOU FRAGAG! Problem solved! It went right to my ROM and built.
    What this also means is that I can now also implement custom compression formats, requiring the user to simply specify an .exe with which to use.