Sonic and Sega Retro Message Board: asm68k - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

asm68k Running it from another program...

#1 User is offline KingofHarts 

Posted 20 July 2014 - 12:49 PM

  • Call me back when people stop shitting in the punch bowl...
  • Posts: 1480
  • Joined: 07-August 10
  • Gender:Male
  • Wiki edits:1
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 User is offline MainMemory 

Posted 20 July 2014 - 12:59 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Probably because the current directory isn't set properly for the process running the batch file.

#3 User is offline KingofHarts 

Posted 20 July 2014 - 04:29 PM

  • Call me back when people stop shitting in the punch bowl...
  • Posts: 1480
  • Joined: 07-August 10
  • Gender:Male
  • Wiki edits:1
Right.

Following this and some GML guides I found, I ended up with this code:

builder="C:\Users\Chris\Documents\Sonic Retro\Hacking\Disassemblies\Mega Drive\Sonic 1 Disassemblies\Sonic 1 REV C (R46)\build.bat" // Builder
path=filename_path(builder); // path of said file
file=filename_name(builder); // filename itself
execute_program(environment_get_variable("COMSPEC"), 'cd "'+path+'"',true);




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 User is offline FraGag 

Posted 20 July 2014 - 11:27 PM

  • Posts: 659
  • Joined: 09-January 08
  • Gender:Male
  • Location:Québec, Canada
  • Project:an assembler
  • Wiki edits:6
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:

/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:

execute_program(environment_get_variable("COMSPEC"), '/c pushd "' + path + '" && "' + file + '"',true);


EDIT: Added the missing /c as noted by KingofHarts below.
This post has been edited by FraGag: 25 July 2014 - 08:51 PM

#5 User is offline KingofHarts 

Posted 25 July 2014 - 01:13 PM

  • Call me back when people stop shitting in the punch bowl...
  • Posts: 1480
  • Joined: 07-August 10
  • Gender:Male
  • Wiki edits:1
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.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users