mirror of
https://github.com/david-schmidt/gsport.git
synced 2024-06-01 12:41:29 +00:00
Simplify image size discovery, rename GSportMac to just GSport
This commit is contained in:
parent
3f3d8902fd
commit
6fe4eba92f
|
@ -41,9 +41,9 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>GSportMac</string>
|
||||
<string>GSport</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>GSportMac</string>
|
||||
<string>GSport</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>gsporticon.icns</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
|
@ -55,9 +55,9 @@
|
|||
<key>CFBundleVersion</key>
|
||||
<string>0.1</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>GSportMac version 0.1</string>
|
||||
<string>GSport version 0.1</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>GSportMac v0.1, Copyright 2010 GSport Contributors, http://gsport.sourceforge.net</string>
|
||||
<string>GSport v0.1, Copyright 2010 GSport Contributors, http://gsport.sourceforge.net</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright 2010 GSport Contributors</string>
|
||||
</dict>
|
||||
|
|
|
@ -29,7 +29,7 @@ gsportmac: $(OBJECTS) compile_time.o
|
|||
$(CC) $(CCOPTS) $(LDOPTS) -arch ppc $(OBJECTS) compile_time.o $(LDFLAGS) -o gsport $(EXTRA_LIBS) -prebind -framework Carbon -framework Quicktime
|
||||
mkdir -p ../GSport.app/Contents/Resources/English.lproj/main.nib
|
||||
mkdir -p ../GSport.app/Contents/MacOS
|
||||
mv gsport ../GSport.app/Contents/MacOS/GSportMac
|
||||
mv gsport ../GSport.app/Contents/MacOS/GSport
|
||||
echo "APPL????" > ../GSport.app/Contents/PkgInfo
|
||||
cp -f Info.plist ../GSport.app/Contents/
|
||||
cp -f info.nib ../GSport.app/Contents/Resources/English.lproj/main.nib
|
||||
|
|
62
src/config.c
62
src/config.c
|
@ -2689,47 +2689,43 @@ cfg_guess_image_size(char *filename)
|
|||
{
|
||||
/*
|
||||
Guess the image size. Return values:
|
||||
-1 : invalid/unknown. Can't guess.
|
||||
0: Less than 140k; might be ram disk image.
|
||||
1: 140k, 5.25" image.
|
||||
2: 800k, 3.5" image.
|
||||
3: Something bigger.
|
||||
-1 : invalid/unknown. Can't guess.
|
||||
0 : Less than 140k; might be ram disk image.
|
||||
1 : 140k, 5.25" image.
|
||||
2 : 800k, 3.5" image.
|
||||
3 : Something bigger.
|
||||
*/
|
||||
struct stat stat_buf;
|
||||
int fd;
|
||||
int rc = -1;
|
||||
int ret;
|
||||
int len;
|
||||
|
||||
fd = open(filename, O_RDONLY | O_BINARY);
|
||||
if(fd < 0)
|
||||
rc = stat(filename, &stat_buf);
|
||||
if(rc < 0)
|
||||
{
|
||||
printf("Open image file %s failed:%d, errno:%d\n",
|
||||
filename, fd, errno);
|
||||
printf("Can't get statistics on file %s; errno: %d\n",
|
||||
filename, errno);
|
||||
rc = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = fstat(fd, &stat_buf);
|
||||
if(ret != 0)
|
||||
{
|
||||
printf("fstat returned %d on fd %d, errno: %d\n",
|
||||
ret, fd, errno);
|
||||
rc = -1;
|
||||
} else {
|
||||
len = stat_buf.st_size;
|
||||
printf("Found file %s, size %d; guessing ",
|
||||
filename, len);
|
||||
if (len < 140 * 1024) {
|
||||
/* Not enough for a 140k image */
|
||||
printf("small ProDOS image.\n");
|
||||
rc = 0;
|
||||
} else if (len < 140 * 1024 + 256 + 1) {
|
||||
/* Reasonable size for 140k image, maybe in 2mg format */
|
||||
printf("a 5-1/4\" image.\n");
|
||||
rc = 1;
|
||||
} else if (len < 800 * 1024 + 256 + 1) {
|
||||
/* Reasonable size for 800k image, maybe in 2mg format */
|
||||
printf("a 3-1/2\" image.\n");
|
||||
rc = 2;
|
||||
} else {
|
||||
/* Let's pretend it's an HDV image */
|
||||
printf("a hard drive image.\n");
|
||||
rc = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = stat_buf.st_size;
|
||||
if (len < 140 * 1024) /* Not enough for a 140k image */
|
||||
rc = 0;
|
||||
else if (len < 140 * 1024 + 256 + 1) /* Reasonable size for 140k image, maybe in 2mg format */
|
||||
rc = 1;
|
||||
else if (len < 800 * 1024 + 256 + 1) /* Reasonable size for 800k image, maybe in 2mg format */
|
||||
rc = 2;
|
||||
else /* Let's pretend it's an HDV image */
|
||||
rc = 3;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ my_cmd_handler( EventHandlerCallRef handlerRef, EventRef event, void *userdata)
|
|||
osresult = noErr;
|
||||
break;
|
||||
case 'abou':
|
||||
show_simple_alert("GSportMac v", (char *)g_kegs_version_str,
|
||||
show_simple_alert("GSport v", (char *)g_kegs_version_str,
|
||||
", Copyright 2010 GSport Contributors\n"
|
||||
"Latest version at http://gsport.sourceforge.net/\n", 0);
|
||||
osresult = noErr;
|
||||
|
@ -762,7 +762,7 @@ main(int argc, char* argv[])
|
|||
//printf("CreateNewWindow ret: %d, g_main_window: %p\n", (int)err,
|
||||
// g_main_window);
|
||||
|
||||
err = SetWindowTitleWithCFString(g_main_window, CFSTR("GSportMac"));
|
||||
err = SetWindowTitleWithCFString(g_main_window, CFSTR("GSport"));
|
||||
|
||||
// We don't need the nib reference anymore.
|
||||
DisposeNibReference(nibRef);
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
<string name="title">main</string>
|
||||
<array count="3" name="items">
|
||||
<object class="IBCarbonMenuItem" id="185">
|
||||
<string name="title">GSportMac</string>
|
||||
<string name="title">GSport</string>
|
||||
<object name="submenu" class="IBCarbonMenu" id="184">
|
||||
<string name="title">GSportMac</string>
|
||||
<string name="title">GSport</string>
|
||||
<array count="3" name="items">
|
||||
<object class="IBCarbonMenuItem" id="187">
|
||||
<string name="title">About GSportMac</string>
|
||||
<string name="title">About GSport</string>
|
||||
<int name="keyEquivalentModifier">0</int>
|
||||
<ostype name="command">abou</ostype>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue
Block a user