GP32 How To Setup Visualstudio For Gp32 Dev


generalnmx

Playful/Fascist Mod
Joined
Apr 18, 2003
Messages
2,128
Age
43
Location
Maryland, USA
Website
www.matts-hosting.com
Don't worry, it's not nearly HALF as evil now. This batch file's ONLY intent is allow you to use non-Windows make.exe in VisualStudio's output window.For some reason, at least with .NET, make crashes if left to the output window. But unless you use the output window, you can't use the nifty "jump-to error/warning line" feature of VS. So here's a little batch file which looks weird, but works:

Code:
erase cerr.txt
type make.log | make
type cerr.txt

I suggest calling the batch file "makevs.bat" and putting it in your \bin directory with make.exe.

For some reason, the pipe direction works when just calling "make.exe" doesn't. By now you're probably thinking VS.NET sucks, and you're probably right, but I like it anyway! Oh, and you're also wondering why I did "type cerr.txt". Well, you want all your errors in a nice paragraph, right? Here you go:

Code:
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@ 2>> cerr.txt

That's from any standard makefile, but notice the "2>> cerr.txt" there. That will redirect all errors into a "cerr.txt" file located in your project's directory.

Now you're wondering, "But how do I make this go to the output window anyway?" Well, that's very easy. In VS.NET you go to Tools->External Tools and make a new External Tool. Put in the path of your command (like "c:\msys\1.0\bin\makevs.bat" and give the initial directory as $(ProjectDir). Make sure to click on your project before compiling, and make sure your project was created in the same place as your GP32 project's source files (just make an empty project so it doesn't create anything). Now you can even add buttons to have one-click compliation!

More on this later.

[Edit - New version of the evil batch file]

I have increased the evilness of the batch file, allowing it's intent to be beyond simple VS.NET compatibility. I'll list the changes and known bugs first.

Changes:
- You can now build THEN run the file on GeePee32. Argument: run
- You can now build the file, create a virtual smc, then run it on Geepee32. Argument: createsmc
- You can now build the file and run the virtual smc on Geepee32. Argument: smcrun
- Redirects all output except warnings and errors into make.log. If you want to see the additional output anyway, use "verbose" as your first argument (without the quotes).

Known Bugs:
- Since we established VS.NET's output window is screwed up, if you just call "makevs.bat" through the output window after a complete build of the project, your only output will be "The process tried to write to a nonexistent pipe."

New makevs.bat
Code:
@echo off
SET MAKEVERBOSE=
if "%1"=="verbose" goto VERBOSE
goto START

:VERBOSE
SET MAKEVERBOSE=true
shift

:START
SET MAKEDIR=c:\msys\1.0\bin

if exist cerr.txt erase cerr.txt
type make.log | %MAKEDIR%\make > make.log
if exist cerr.txt type cerr.txt

if "%1"=="run" goto RUN
if "%1"=="createsmc" goto MAKESMC
if "%1"=="smcrun" goto SMC
goto END

:RUN
%MAKEDIR%\make run >> make.log
goto END

:MAKESMC
%MAKEDIR%\make createsmc >> make.log

:SMC
%MAKEDIR%\make smcrun >> make.log

:END
if "%MAKEVERBOSE%"=="true" if exist make.log type make.log

SET MAKEDIR=
SET MAKEVERBOSE=
@echo on

In addition, add something like this to your project's Makefile:

Code:
run:
    $(EMUTOOL) //bin $(FXE) //run
createsmc:
    $(SMCTOOL) $(SMCDIR) $(SMC)
smcrun:
    $(EMUTOOL) //smc $(SMC) //run

FXE is the name of your project's outputted FXE file.
EMUTOOL is the path to the GeePee32 emulator (flags are for v0.43).
SMCTOOL is the path to the virtual SMC tool.
SMCDIR is the path to the directory on your HDD created into a virtual SMC.
SMC is the name of the outputted SMC file.
 
Back
Top