Briefly, I have a text file list of mahjong, fighting, pr0n, games, (one game per line) that I want to remove from a custom mame compile.
I would like a program that reads the gamename, searches a specified driver.c file from the mame source, and inserts // in front of the driver.c file entry to comment out the game. The program should be smart enough that if I tell it to comment out mtrap, it doesn't comment out mtrap3 (unless it finds that also).
Below is a Wordperfect macro I wrote which does this. It works fine except it crashes if there is a game in the pr0n list that is not in the current driver.c file. However, only one of my computers has WordPerfect on it, and I only use that for running this macro, so I would like to move it to something more universal.
BTW, any new program needs to be capable of running on Win2K without admin rights or registry changes.
Here's the WordPerfect macro (comments are generally before the line they apply to)(bold lines are macro code not comments), the language is pretty simple except
Go(Point 3) - Sends execution to "Label(Point 3)" and
Label (Point 3) - Flag for the Go commands to go to:
Application (WordPerfect; "WordPerfect"; Default; "US")
// Macro is launched after opening the pr0n list, and with no other WP files open.
// Driver.c from the current build is also copied to the C:\download folder before // // running.
// Initial variables, and I set D different from B intentionally.
Declare B
B="g"
Declare C
C="g"
Declare D
D="G"
// Open driver.c
FileOpen (Filename: "C:\download\driver.c")
// Back to the pr0n list
DocPrevious
// Go to top of file
PosDocVeryTop
// Flag the starting point so we can return to it
Label(Point1)
// Get name of game to block
SelectSentence()
// Save this as macro variable A
GetWPdata (MacroVariable:A;selectedText!)
// Turn off selection feature
SelectMode(Off!)
// Change Variable B to "TESTDRIVER( gamename )" for current builds, B should be "// DRIVER ( gamename )"
B="TESTDRIVER( "+A+" )"
// Originally, the macro ended up in a loop after the last game in the pr0n list. The next four lines prevent this.
If (B=D)
Go(Point5)
Endif
D=B
// Change Variable C to "DRIVER( gamename )" This ensures we find mtrap and not mtrap3.
C="DRIVER( "+A+" )"
// Back to driver.c
DocPrevious
// To top of file
PosDocVeryTop
// first check whether the game is already changed. This takes care of duplicate entries in the pr0n list, or before I had the exit on last entry set up. If already changed, go to next game.
OnNotFound(Point3)
SearchString (StrgToLookFor: B)
SearchNext (SearchMode: Extended!)
Go(Point2)
Label(Point3)
// back to top of driver.c
PosDocVeryTop
// Search for DRIVER and change to TESTDRIVER
OnNotFound(Point4)
SearchString (StrgToLookFor: C)
SearchNext (SearchMode: Regular!)
ReplaceString (RplcStrg: B)
ReplaceCurrent ()
MatchSelection ()
Go(Point2)
Label(Point4)
// This was supposed to tell me what game it crashed on, but it didn't work so is commented out of the original macro
// Prompt("Game Not Found";"Type(Text: A) was not found. Please verify";StopSign)
// Pause
// EndPrompt
Label(Point2)
// back to pr0n list
DocPrevious
// next game
PosLineDown()
// start over.
Go(Point1)
Label(Point5)
Quit
Thanks in advance!!!