From 9221b2f66dbc7a08b22a7365e2431e027e382322 Mon Sep 17 00:00:00 2001 From: mahoneyt944 <49591133+mahoneyt944@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:08:30 -0400 Subject: [PATCH] DAT magic cleanup --- tools/datmagic/datmagic.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tools/datmagic/datmagic.c b/tools/datmagic/datmagic.c index 37883d84..fbd0d496 100644 --- a/tools/datmagic/datmagic.c +++ b/tools/datmagic/datmagic.c @@ -1,6 +1,6 @@ /* - Beta version 5 - Jan. 17th 2021 + Beta version 6 - Jan. 17th 2021 by: mahoneyt944 - MAME 2003-Plus Team. */ @@ -58,8 +58,8 @@ int main() char graphic[] = "graphic=\""; char protection[] = "protection=\""; - /***************** Flags and counters *****************/ - int found=0, parentsample=0, clonesample=0; + /***************** Counter *****************/ + int found=0; /***************** Allocate memory to use *****************/ char *romname = malloc(sizeof(char) * 30); @@ -165,7 +165,6 @@ int main() target = ( char * )malloc( end - start + 1 ); memcpy( target, start, end - start ); target[end - start] = '\0'; - clonesample = 1; strcpy( sampleused, target ); } @@ -189,14 +188,14 @@ int main() } /***************** Read sample tag *****************/ - else if ( (start = strstr( readline, sample_id )) && !(parentsample) ) + else if ( (start = strstr( readline, sample_id )) && (sampleused[0] == '\0') ) { if (( start = strstr( readline, name ) )) { start += strlen( name ); if (( end = strstr( start, "\"" ) )) { - parentsample = 1; + strcpy( sampleused, romname ); } } } @@ -307,11 +306,6 @@ int main() { if ( romname[0] != '\0' ) { - /***************** Configure parent sample *****************/ - if ( parentsample && !clonesample ) strcpy( sampleused, romname ); - else if ( !parentsample && !clonesample ) sampleused[0] = '\0'; - - /***************** Write out html table data *****************/ fputs( "\t\t