--- xmil/palm/m68k.c 2005/02/07 16:56:32 1.1 +++ xmil/palm/m68k.c 2005/02/27 18:22:06 1.3 @@ -1,27 +1,3 @@ -/********** - * Copyright (c) 2004 Greg Parker. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY GREG PARKER ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **********/ - #include #include #include @@ -32,6 +8,10 @@ #include "resource.h" #include "UFD.h" +#ifndef vfsVolumeAttrNonRemovable +#define vfsVolumeAttrNonRemovable 0x00000008L +#endif + #define ByteSwap16(n) ( ((((unsigned int) n) << 8) & 0xFF00) | \ ((((unsigned int) n) >> 8) & 0x00FF) ) @@ -41,7 +21,7 @@ ((((unsigned long) n) >> 8) & 0x0000FF00) | \ ((((unsigned long) n) >> 24) & 0x000000FF) ) -static UInt16 volRefNum; +static UInt16 volRefNum = vfsInvalidVolRef; enum { SEEK_SET = 0, SEEK_CUR = 1, @@ -81,6 +61,17 @@ void unload(PealModule *m) PealUnload(m); } +static void disp_error(const char* msg, const char* data) { + + char str[256]; + MemSet(str, 255, 0); + StrCat(str, msg); + StrCat(str, data); + + FrmCustomAlert(IDD_ALERT, str, NULL, NULL); +} + + static BOOL checkHR(void) { // HighDensity機能の有無をチェック @@ -195,6 +186,8 @@ FileRef file_open_68k(void* path) { if (!error) { return(ref); } + + disp_error("cannot open this file: ", path); return(FILEH_INVALID); } @@ -214,6 +207,7 @@ FileRef file_create_68k(void *path) { } } } + disp_error("cannot create this file: ", path); return(FILEH_INVALID); } @@ -328,6 +322,7 @@ short file_dircreate_68k(const void *pat return(0); } + disp_error("cannot create this dir: ", path); return(-1); } @@ -622,8 +617,8 @@ UInt32 PilotMain(UInt16 cmd, void *cmdPB { PealModule *m; UInt32 volIterator = vfsIteratorStart; + VolumeInfoType info; FormType *frmP; - Err err; int ret; const RGBColorType white = {0, 255, 255, 255}; @@ -634,6 +629,7 @@ UInt32 PilotMain(UInt16 cmd, void *cmdPB FrmCustomAlert(IDD_ALERT, "cannot run under this device.", NULL, NULL); return 0; } + FrmGotoForm(IDD_MAIN); frmP = FrmInitForm(IDD_MAIN); FrmSetActiveForm(frmP); @@ -641,12 +637,15 @@ UInt32 PilotMain(UInt16 cmd, void *cmdPB WinSetBackColorRGB(&white, NULL); while (volIterator != vfsIteratorStop) { - err = VFSVolumeEnumerate(&volRefNum, &volIterator); - if (err == errNone) { - break; + if (VFSVolumeEnumerate(&volRefNum, &volIterator) == errNone) { + if (VFSVolumeInfo(volRefNum, &info) == errNone) { + if ((!info.attributes & vfsVolumeAttrHidden) && (!info.attributes & vfsVolumeAttrNonRemovable)) { + break; + } + } } } - + m = load(); ret = setup(m); unload(m);