mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Working up to start of menu loading
This commit is contained in:
@@ -20,6 +20,8 @@ namespace PortabilityLayer
|
||||
|
||||
int OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
int OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
bool ReadFileProperties(uint32_t dirID, const PLPasStr &filename, MacFileProperties &properties) override;
|
||||
IOStream *GetFileStream(int fileID) override;
|
||||
|
||||
int RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
int RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
@@ -64,6 +66,28 @@ namespace PortabilityLayer
|
||||
int FileManagerImpl::OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
return OpenFileFork(dirID, filename, ".gpr", permission, outRefNum);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::ReadFileProperties(uint32_t dirID, const PLPasStr &filename, MacFileProperties &properties)
|
||||
{
|
||||
IOStream *stream = nullptr;
|
||||
int err = RawOpenFileFork(dirID, filename, ".gpf", EFilePermission_Read, true, &stream);
|
||||
if (err)
|
||||
return false;
|
||||
|
||||
MacFilePropertiesSerialized serialized;
|
||||
bool readOk = (stream->Read(serialized.m_data, MacFilePropertiesSerialized::kSize) == MacFilePropertiesSerialized::kSize);
|
||||
stream->Close();
|
||||
|
||||
if (readOk)
|
||||
serialized.Deserialize(properties);
|
||||
|
||||
return readOk;
|
||||
}
|
||||
|
||||
IOStream *FileManagerImpl::GetFileStream(int fileID)
|
||||
{
|
||||
return m_refs[fileID].m_stream;
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
@@ -94,7 +118,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
if (refIndex == 0x7fff)
|
||||
if (refIndex == 0x8000)
|
||||
return tmfoErr;
|
||||
|
||||
IOStream *stream = nullptr;
|
||||
@@ -110,7 +134,7 @@ namespace PortabilityLayer
|
||||
of.m_dirID = static_cast<EVirtualDirectory>(dirID);
|
||||
of.m_fileName.Set(filename.Length(), filename.Chars());
|
||||
|
||||
*outRefNum = static_cast<short>(refIndex + 1);
|
||||
*outRefNum = static_cast<short>(refIndex);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
@@ -132,11 +156,11 @@ namespace PortabilityLayer
|
||||
return fnfErr;
|
||||
}
|
||||
|
||||
const bool needToCreate = !(ignoreMeta || HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN));
|
||||
|
||||
if (!ConstructFilename(extFN, filename, ext))
|
||||
return bdNamErr;
|
||||
|
||||
const bool needToCreate = !(ignoreMeta || HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN));
|
||||
|
||||
IOStream *fstream = nullptr;
|
||||
switch (permission)
|
||||
{
|
||||
@@ -180,7 +204,7 @@ namespace PortabilityLayer
|
||||
if (c >= '0' && c <= '9')
|
||||
continue;
|
||||
|
||||
if (c == '_')
|
||||
if (c == '_' || c == '.' || c == '\'')
|
||||
continue;
|
||||
|
||||
if (c == ' ' && i != 0 && i != fnameSize - 1)
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#define __PL_FILE_MANAGER_H__
|
||||
|
||||
#include "FilePermission.h"
|
||||
#include "CoreDefs.h"
|
||||
#include "CoreDefs.h"
|
||||
#include "FilePos.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -11,7 +12,8 @@ class PLPasStr;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream;
|
||||
class IOStream;
|
||||
struct MacFileProperties;
|
||||
|
||||
class FileManager
|
||||
{
|
||||
@@ -20,6 +22,8 @@ namespace PortabilityLayer
|
||||
|
||||
virtual int OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) = 0;
|
||||
virtual int OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) = 0;
|
||||
virtual bool ReadFileProperties(uint32_t dirID, const PLPasStr &filename, MacFileProperties &properties) = 0;
|
||||
virtual IOStream *GetFileStream(int fileID) = 0;
|
||||
|
||||
virtual int RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) = 0;
|
||||
virtual int RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) = 0;
|
||||
|
||||
9
PortabilityLayer/FilePos.h
Normal file
9
PortabilityLayer/FilePos.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
typedef int64_t FilePos_t;
|
||||
typedef uint64_t UFilePos_t;
|
||||
}
|
||||
11
PortabilityLayer/HostDirectoryCursor.h
Normal file
11
PortabilityLayer/HostDirectoryCursor.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostDirectoryCursor
|
||||
{
|
||||
public:
|
||||
virtual bool GetNext(const char *&outFileName) = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
}
|
||||
@@ -6,13 +6,15 @@
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream;
|
||||
class IOStream;
|
||||
class HostDirectoryCursor;
|
||||
|
||||
class HostFileSystem
|
||||
{
|
||||
public:
|
||||
virtual bool FileExists(EVirtualDirectory virtualDirectory, const char *path) = 0;
|
||||
virtual IOStream *OpenFile(EVirtualDirectory virtualDirectory, const char *path, bool writeAccess, bool create) = 0;
|
||||
virtual HostDirectoryCursor *ScanDirectory(EVirtualDirectory virtualDirectory) = 0;
|
||||
|
||||
static HostFileSystem *GetInstance();
|
||||
static void SetInstance(HostFileSystem *instance);
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
#ifndef __PL_IOTREAM_H__
|
||||
#define __PL_IOTREAM_H__
|
||||
|
||||
#include "DataTypes.h"
|
||||
#include "DataTypes.h"
|
||||
#include "FilePos.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
typedef int64_t FilePos_t;
|
||||
typedef uint64_t UFilePos_t;
|
||||
|
||||
class IOStream
|
||||
{
|
||||
public:
|
||||
|
||||
14
PortabilityLayer/MacLatin.h
Normal file
14
PortabilityLayer/MacLatin.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
namespace MacLatin
|
||||
{
|
||||
extern const uint16_t g_toUnicode[256];
|
||||
extern const uint8_t g_stripDiacritic[256];
|
||||
extern const uint8_t g_toLower[256];
|
||||
extern const uint8_t g_toUpper[256];
|
||||
}
|
||||
}
|
||||
95
PortabilityLayer/MacLatin1.cpp
Normal file
95
PortabilityLayer/MacLatin1.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
#include "MacLatin.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
namespace MacLatin
|
||||
{
|
||||
const uint16_t g_toUnicode[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1, 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8, // 8
|
||||
0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3, 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc, // 9
|
||||
0x00dd, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x00d7, 0x00b6, 0x00df, 0x00ae, 0x00a9, 0x00b2, 0x00b4, 0x00a8, 0x00b3, 0x00c6, 0x00d8, // 10
|
||||
0x00b9, 0x00b1, 0x00bc, 0x00bd, 0x00a5, 0x00b5, 0xffff, 0xffff, 0xffff, 0xffff, 0x00be, 0x00aa, 0x00ba, 0xffff, 0x00e6, 0x00f8, // 11
|
||||
0x00bf, 0x00a1, 0x00ac, 0x0141, 0x0192, 0x02cb, 0xffff, 0x00ab, 0x00bb, 0x00a6, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153, // 12
|
||||
0x00ad, 0xffff, 0xffff, 0xffff, 0x0142, 0xffff, 0x00f7, 0xffff, 0x00ff, 0x0178, 0xffff, 0x00a4, 0x00d0, 0x00f0, 0x00de, 0x00fe, // 13
|
||||
0x00fd, 0x00b7, 0xffff, 0xffff, 0xffff, 0x00c2, 0x00ca, 0x00c1, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4, // 14
|
||||
0xffff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc, 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7, // 15
|
||||
};
|
||||
|
||||
const uint8_t g_stripDiacritic[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
'A', 'A', 'C', 'E', 'N', 'O', 'U', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', // 8
|
||||
'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', // 9
|
||||
'Y', 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 'O', // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 'o', // b
|
||||
192, 193, 194, 'L', 196, 197, 198, 199, 200, 201, 202, 'A', 'A', 'O', 206, 207, // c
|
||||
208, 209, 210, 211, 'l', 213, 214, 215, 'y', 'Y', 218, 219, 220, 221, 222, 223, // d
|
||||
224, 225, 226, 227, 228, 'A', 'E', 'A', 'E', 'E', 'I', 'I', 'I', 'I', 'O', 'O', // e
|
||||
240, 'O', 'U', 'U', 'U', 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
|
||||
const uint8_t g_toUpper[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', // 6
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 123, 124, 125, 126, 127, // 7
|
||||
|
||||
128, 129, 130, 131, 132, 133, 134, 231, 203, 229, 128, 204, 129, 130, 131, 143, // 8
|
||||
230, 232, 234, 237, 235, 236, 132, 238, 241, 239, 133, 205, 242, 244, 243, 134, // 9
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 174, 175, // b
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 206, // c
|
||||
208, 209, 210, 211, 195, 213, 214, 215, 217, 217, 218, 219, 220, 220, 222, 222, // d
|
||||
160, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // e
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
|
||||
const uint8_t g_toLower[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', // 4
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
138, 140, 141, 142, 150, 154, 159, 135, 136, 137, 138, 139, 140, 141, 142, 143, // 8
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 9
|
||||
224, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 190, 191, // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, // b
|
||||
192, 193, 194, 212, 196, 197, 198, 199, 200, 201, 202, 136, 139, 155, 207, 207, // c
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 216, 218, 219, 221, 221, 223, 223, // d
|
||||
224, 225, 226, 227, 228, 137, 144, 135, 145, 143, 146, 148, 149, 147, 151, 153, // e
|
||||
240, 152, 156, 158, 157, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "PLAliases.h"
|
||||
|
||||
OSErr ResolveAliasFile(FSSpecPtr fsSpec, Boolean recursive, Boolean *outIsFolder, Boolean *outWasAliased)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
{
|
||||
*outIsFolder = PL_FALSE;
|
||||
*outWasAliased = PL_FALSE;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,14 @@
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "FileManager.h"
|
||||
#include "FilePermission.h"
|
||||
#include "HostDirectoryCursor.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostSuspendCallArgument.h"
|
||||
#include "HostSuspendHook.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "HostSystemServices.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "MacFileInfo.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "MemReaderStream.h"
|
||||
#include "MMHandleBlock.h"
|
||||
@@ -23,6 +26,29 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
static bool ConvertFilenameToSafePStr(const char *str, uint8_t *pstr)
|
||||
{
|
||||
const char *strBase = str;
|
||||
while (*str)
|
||||
{
|
||||
const char c = *str++;
|
||||
|
||||
if (c == '.' || c == ' ' || c == '_' || c == '\'' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
ptrdiff_t len = str - strBase;
|
||||
if (len > 31)
|
||||
return false;
|
||||
|
||||
memcpy(pstr + 1, strBase, static_cast<size_t>(len));
|
||||
pstr[0] = static_cast<uint8_t>(len);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitCursor()
|
||||
{
|
||||
}
|
||||
@@ -414,7 +440,11 @@ OSErr FSWrite(short refNum, long *byteCount, const void *data)
|
||||
|
||||
OSErr FSRead(short refNum, long *byteCount, void *data)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PortabilityLayer::IOStream *stream = PortabilityLayer::FileManager::GetInstance()->GetFileStream(refNum);
|
||||
|
||||
const size_t bytesRead = stream->Read(data, static_cast<size_t>(*byteCount));
|
||||
*byteCount = static_cast<long>(bytesRead);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -426,19 +456,35 @@ OSErr FSpDelete(const FSSpec *spec)
|
||||
|
||||
OSErr FSpGetFInfo(const FSSpec *spec, FInfo *finfo)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PortabilityLayer::MacFileProperties mfp;
|
||||
if (!PortabilityLayer::FileManager::GetInstance()->ReadFileProperties(static_cast<uint32_t>(spec->parID), spec->name, mfp))
|
||||
return fnfErr;
|
||||
|
||||
finfo->fdType = PortabilityLayer::ResTypeIDCodec::Decode(mfp.m_fileType);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
OSErr SetFPos(short refNum, SetFPosWhere where, long offset)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
switch (where)
|
||||
{
|
||||
case fsFromStart:
|
||||
if (!PortabilityLayer::FileManager::GetInstance()->GetFileStream(refNum)->SeekStart(static_cast<PortabilityLayer::UFilePos_t>(offset)))
|
||||
return ioErr;
|
||||
break;
|
||||
default:
|
||||
return genericErr;
|
||||
}
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
OSErr GetEOF(short refNum, long *byteCount)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
const PortabilityLayer::UFilePos_t fileSize = PortabilityLayer::FileManager::GetInstance()->GetFileStream(refNum)->Size();
|
||||
|
||||
*byteCount = static_cast<long>(fileSize);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@@ -454,6 +500,95 @@ OSErr PBGetCatInfo(CInfoPBPtr paramBlock, Boolean async)
|
||||
return noErr;
|
||||
}
|
||||
|
||||
DirectoryFileListEntry *GetDirectoryFiles(long dirID)
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
PortabilityLayer::HostFileSystem *fs = PortabilityLayer::HostFileSystem::GetInstance();
|
||||
PortabilityLayer::HostDirectoryCursor *dirCursor = fs->ScanDirectory(static_cast<PortabilityLayer::EVirtualDirectory>(dirID));
|
||||
|
||||
DirectoryFileListEntry *firstDFL = nullptr;
|
||||
DirectoryFileListEntry *lastDFL = nullptr;
|
||||
|
||||
if (!dirCursor)
|
||||
return nullptr;
|
||||
|
||||
const char *filename;
|
||||
char fnCopy[256];
|
||||
while (dirCursor->GetNext(filename))
|
||||
{
|
||||
const size_t fnLen = strlen(filename);
|
||||
if (fnLen < 5 || fnLen > 255)
|
||||
continue;
|
||||
|
||||
memcpy(fnCopy, filename, fnLen + 1);
|
||||
|
||||
if (!strcmp(&filename[fnLen - 4], ".gpf"))
|
||||
{
|
||||
const size_t dotPos = fnLen - 4;
|
||||
PortabilityLayer::IOStream *stream = fs->OpenFile(static_cast<PortabilityLayer::EVirtualDirectory>(dirID), filename, false, false);
|
||||
if (!stream)
|
||||
continue;
|
||||
|
||||
PortabilityLayer::MacFileProperties mfp;
|
||||
PortabilityLayer::MacFilePropertiesSerialized mfs;
|
||||
|
||||
const size_t gpfSize = stream->Read(mfs.m_data, PortabilityLayer::MacFilePropertiesSerialized::kSize);
|
||||
stream->Close();
|
||||
|
||||
if (gpfSize != PortabilityLayer::MacFilePropertiesSerialized::kSize)
|
||||
continue;
|
||||
|
||||
mfs.Deserialize(mfp);
|
||||
|
||||
fnCopy[dotPos] = '\0';
|
||||
|
||||
DirectoryFileListEntry tempDFL;
|
||||
tempDFL.finderInfo.fdType = PortabilityLayer::ResTypeIDCodec::Decode(mfp.m_fileType);
|
||||
tempDFL.finderInfo.fdCreator = PortabilityLayer::ResTypeIDCodec::Decode(mfp.m_fileCreator);
|
||||
tempDFL.nextEntry = nullptr;
|
||||
if (!ConvertFilenameToSafePStr(fnCopy, tempDFL.name))
|
||||
continue;
|
||||
|
||||
DirectoryFileListEntry *dfl = static_cast<DirectoryFileListEntry*>(mm->Alloc(sizeof(DirectoryFileListEntry)));
|
||||
if (!dfl)
|
||||
{
|
||||
if (firstDFL)
|
||||
DisposeDirectoryFiles(firstDFL);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
new (dfl) DirectoryFileListEntry(tempDFL);
|
||||
|
||||
dfl->nextEntry = nullptr;
|
||||
|
||||
if (lastDFL)
|
||||
lastDFL->nextEntry = dfl;
|
||||
else
|
||||
firstDFL = dfl;
|
||||
|
||||
lastDFL = dfl;
|
||||
}
|
||||
}
|
||||
|
||||
dirCursor->Destroy();
|
||||
|
||||
return firstDFL;
|
||||
}
|
||||
|
||||
void DisposeDirectoryFiles(DirectoryFileListEntry *firstDFL)
|
||||
{
|
||||
PortabilityLayer::MemoryManager *mm = PortabilityLayer::MemoryManager::GetInstance();
|
||||
|
||||
DirectoryFileListEntry *dfl = firstDFL;
|
||||
while (dfl)
|
||||
{
|
||||
DirectoryFileListEntry *nextDFL = dfl->nextEntry;
|
||||
mm->Release(dfl);
|
||||
dfl = nextDFL;
|
||||
}
|
||||
}
|
||||
|
||||
short StringWidth(const PLPasStr &str)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
@@ -621,12 +756,10 @@ void PurgeSpace(long *totalFree, long *contiguousFree)
|
||||
|
||||
void HSetState(Handle handle, char state)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
char HGetState(Handle handle)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -671,6 +804,10 @@ void PL_NotYetImplemented_Minor()
|
||||
{
|
||||
}
|
||||
|
||||
void PL_NotYetImplemented_TODO()
|
||||
{
|
||||
}
|
||||
|
||||
void PL_Init()
|
||||
{
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Init();
|
||||
|
||||
@@ -51,7 +51,7 @@ struct FileInfoBlock
|
||||
void *ioCompletion;
|
||||
short ioVRefNum; // Volume ref num
|
||||
StringPtr ioNamePtr;
|
||||
int ioFDirIndex; // Index (1-based!)
|
||||
int ioFDirIndex; // Index: If >0, Nth directory in ioVRefNum. If 0, lookup by name. If <0, do behavior that we don't support.
|
||||
long ioDirID; // Input: Directory ID Output: File ID
|
||||
int ioFlAttrib; // File attributes
|
||||
FinderInfoBlock ioFlFndrInfo;
|
||||
@@ -74,6 +74,13 @@ struct CInfoPBRec
|
||||
DirInfoBlock dirInfo;
|
||||
};
|
||||
|
||||
struct DirectoryFileListEntry
|
||||
{
|
||||
FinderInfoBlock finderInfo;
|
||||
Str32 name;
|
||||
DirectoryFileListEntry *nextEntry;
|
||||
};
|
||||
|
||||
struct Cursor
|
||||
{
|
||||
};
|
||||
@@ -324,6 +331,7 @@ OSErr FSMakeFSSpec(int refNum, long dirID, const PLPasStr &fileName, FSSpec *spe
|
||||
OSErr FSpCreate(const FSSpec *spec, UInt32 creator, UInt32 fileType, ScriptCode scriptTag);
|
||||
OSErr FSpDirCreate(const FSSpec *spec, ScriptCode script, long *outDirID);
|
||||
OSErr FSpOpenDF(const FSSpec *spec, int permission, short *refNum);
|
||||
OSErr FSpOpenRF(const FSSpec *spec, int permission, short *refNum);
|
||||
OSErr FSWrite(short refNum, long *byteCount, const void *data);
|
||||
OSErr FSRead(short refNum, long *byteCount, void *data);
|
||||
OSErr FSpDelete(const FSSpec *spec);
|
||||
@@ -334,6 +342,9 @@ OSErr SetEOF(short refNum, long byteCount);
|
||||
|
||||
OSErr PBGetCatInfo(CInfoPBPtr paramBlock, Boolean async);
|
||||
|
||||
DirectoryFileListEntry *GetDirectoryFiles(long dirID);
|
||||
void DisposeDirectoryFiles(DirectoryFileListEntry *firstDFL);
|
||||
|
||||
short StringWidth(const PLPasStr &str);
|
||||
|
||||
void GetMouse(Point *point);
|
||||
@@ -393,6 +404,7 @@ WindowPtr PL_GetPutInFrontWindowPtr();
|
||||
|
||||
void PL_NotYetImplemented();
|
||||
void PL_NotYetImplemented_Minor();
|
||||
void PL_NotYetImplemented_TODO();
|
||||
void PL_Init();
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "PLMenus.h"
|
||||
|
||||
#include "PLMenus.h"
|
||||
|
||||
MenuHandle GetMenu(int resID)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,13 @@ OSErr AddUserData(UserData userData, Handle data, UInt32 type)
|
||||
|
||||
OSErr OpenMovieFile(const FSSpec *fsSpec, short *outRefNum, int permissions)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PL_NotYetImplemented_TODO();
|
||||
return noErr;
|
||||
}
|
||||
|
||||
OSErr NewMovieFromFile(Movie *movie, short refNum, const short *optResId, StringPtr resName, int flags, Boolean *unused)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PL_NotYetImplemented_TODO();
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ void PaintRect(const Rect *rect)
|
||||
break;
|
||||
default:
|
||||
PL_NotYetImplemented();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ void FrameRoundRect(const Rect *rect, int w, int h)
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void PenMode(int mode)
|
||||
void PenMode(CopyBitsMode copyBitsMode)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
@@ -316,11 +316,6 @@ void PenMode(PenModeID penMode)
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void PenMode(CopyBitsMode copyBitsMode)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void PenPat(const Pattern *pattern)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
|
||||
@@ -55,17 +55,16 @@ enum SystemFontID
|
||||
mobile = 24,
|
||||
};
|
||||
|
||||
// wtf?
|
||||
enum SystemColorID
|
||||
{
|
||||
whiteColor = 30,
|
||||
blackColor = 33,
|
||||
yellowColor = 69,
|
||||
magentaColor = 137,
|
||||
redColor = 205,
|
||||
cyanColor = 273,
|
||||
greenColor = 341,
|
||||
blueColor = 409,
|
||||
whiteColor = 1,
|
||||
blackColor,
|
||||
yellowColor,
|
||||
magentaColor,
|
||||
redColor,
|
||||
cyanColor,
|
||||
greenColor,
|
||||
blueColor,
|
||||
};
|
||||
|
||||
enum CopyBitsMode
|
||||
@@ -73,29 +72,13 @@ enum CopyBitsMode
|
||||
srcCopy,
|
||||
srcOr,
|
||||
srcXor,
|
||||
srcBic,
|
||||
notSrcCopy,
|
||||
notSrcOr,
|
||||
notSrcXor,
|
||||
notSrcBic,
|
||||
transparent
|
||||
transparent,
|
||||
};
|
||||
|
||||
enum PenModeID
|
||||
{
|
||||
patCopy = 8,
|
||||
patOr,
|
||||
patOr = transparent + 1,
|
||||
patXor,
|
||||
patBic,
|
||||
notPatCopy,
|
||||
notPatOr,
|
||||
notPatXor,
|
||||
notPatBic,
|
||||
};
|
||||
|
||||
enum HiliteMode
|
||||
{
|
||||
hilite = 50,
|
||||
};
|
||||
|
||||
struct CIcon
|
||||
@@ -165,7 +148,8 @@ void ClipRect(const Rect *rect); // Sets the clipping area
|
||||
void FrameRect(const Rect *rect);
|
||||
void FrameOval(const Rect *rect);
|
||||
void FrameRoundRect(const Rect *rect, int w, int h);
|
||||
void PenMode(int mode); // Can be CopyBitsMode, PenModeID, and possibly add "50" to hilite
|
||||
void PenMode(CopyBitsMode copyBitsMode);
|
||||
void PenMode(PenModeID mode);
|
||||
void PenPat(const Pattern *pattern);
|
||||
void PenSize(int w, int h);
|
||||
void PenNormal();
|
||||
|
||||
@@ -34,7 +34,16 @@ namespace PortabilityLayer
|
||||
static ResourceManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
std::vector<ResourceFile*> m_resFiles;
|
||||
struct ResFileSlot
|
||||
{
|
||||
short m_prevFile;
|
||||
short m_nextFile;
|
||||
ResourceFile* m_resourceFile;
|
||||
};
|
||||
|
||||
std::vector<ResFileSlot> m_resFiles;
|
||||
short m_firstResFile;
|
||||
short m_lastResFile;
|
||||
short m_currentResFile;
|
||||
bool m_load;
|
||||
|
||||
@@ -42,7 +51,9 @@ namespace PortabilityLayer
|
||||
};
|
||||
|
||||
ResourceManagerImpl::ResourceManagerImpl()
|
||||
: m_currentResFile(0)
|
||||
: m_currentResFile(-1)
|
||||
, m_firstResFile(-1)
|
||||
, m_lastResFile(-1)
|
||||
, m_load(true)
|
||||
{
|
||||
}
|
||||
@@ -54,8 +65,8 @@ namespace PortabilityLayer
|
||||
|
||||
void ResourceManagerImpl::Shutdown()
|
||||
{
|
||||
for (std::vector<ResourceFile*>::iterator it = m_resFiles.begin(), itEnd = m_resFiles.end(); it != itEnd; ++it)
|
||||
delete (*it);
|
||||
for (std::vector<ResFileSlot>::iterator it = m_resFiles.begin(), itEnd = m_resFiles.end(); it != itEnd; ++it)
|
||||
delete it->m_resourceFile;
|
||||
|
||||
m_resFiles.clear();
|
||||
}
|
||||
@@ -87,7 +98,7 @@ namespace PortabilityLayer
|
||||
|
||||
for (size_t i = 0; i < numSlots; i++)
|
||||
{
|
||||
if (m_resFiles[i] == nullptr)
|
||||
if (m_resFiles[i].m_resourceFile == nullptr)
|
||||
{
|
||||
resFileIndex = i;
|
||||
break;
|
||||
@@ -95,11 +106,11 @@ namespace PortabilityLayer
|
||||
}
|
||||
|
||||
if (resFileIndex == 0x7fff)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
IOStream *fStream = nullptr;
|
||||
if (FileManager::GetInstance()->RawOpenFileRF(virtualDir, filename, EFilePermission_Read, true, &fStream) != noErr)
|
||||
return 0;
|
||||
return -1;
|
||||
|
||||
ResourceFile *resFile = new ResourceFile();
|
||||
bool loaded = resFile->Load(fStream);
|
||||
@@ -108,27 +119,48 @@ namespace PortabilityLayer
|
||||
if (!loaded)
|
||||
{
|
||||
delete resFile;
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (resFileIndex == numSlots)
|
||||
m_resFiles.push_back(resFile);
|
||||
else
|
||||
m_resFiles[resFileIndex] = resFile;
|
||||
ResFileSlot slot;
|
||||
slot.m_resourceFile = resFile;
|
||||
slot.m_prevFile = m_lastResFile;
|
||||
slot.m_nextFile = -1;
|
||||
|
||||
return static_cast<short>(resFileIndex + 1);
|
||||
if (resFileIndex == numSlots)
|
||||
m_resFiles.push_back(slot);
|
||||
else
|
||||
m_resFiles[resFileIndex] = slot;
|
||||
|
||||
const short rfid = static_cast<short>(resFileIndex);
|
||||
|
||||
if (m_firstResFile < 0)
|
||||
m_firstResFile = rfid;
|
||||
|
||||
if (m_lastResFile >= 0)
|
||||
m_resFiles[m_lastResFile].m_nextFile = rfid;
|
||||
|
||||
m_lastResFile = rfid;
|
||||
m_currentResFile = rfid; // Resource Manager is supposed to reset the search stack on new file open
|
||||
|
||||
return rfid;
|
||||
}
|
||||
|
||||
MMHandleBlock *ResourceManagerImpl::GetResource(const ResTypeID &resType, int id)
|
||||
{
|
||||
if (!m_currentResFile)
|
||||
return nullptr;
|
||||
short searchIndex = m_currentResFile;
|
||||
while (searchIndex >= 0)
|
||||
{
|
||||
const ResFileSlot& slot = m_resFiles[searchIndex];
|
||||
assert(slot.m_resourceFile);
|
||||
|
||||
ResourceFile *resFile = m_resFiles[m_currentResFile - 1];
|
||||
if (!resFile)
|
||||
return nullptr;
|
||||
if (MMHandleBlock *block = slot.m_resourceFile->GetResource(resType, id, m_load))
|
||||
return block;
|
||||
|
||||
return resFile->GetResource(resType, id, m_load);
|
||||
searchIndex = slot.m_prevFile;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
#include "PLResources.h"
|
||||
|
||||
#include "HostFileSystem.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "MMHandleBlock.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "ResourceCompiledRef.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
struct PLOpenedResFile
|
||||
{
|
||||
bool m_isOpen;
|
||||
};
|
||||
|
||||
static const unsigned int kPLMaxOpenedResFiles = 64;
|
||||
static PLOpenedResFile gs_resFiles[kPLMaxOpenedResFiles];
|
||||
|
||||
void DetachResource(Handle hdl)
|
||||
{
|
||||
if (!hdl)
|
||||
@@ -32,7 +42,7 @@ short CurResFile()
|
||||
|
||||
void UseResFile(short fid)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
PortabilityLayer::ResourceManager::GetInstance()->SetCurrentResFile(fid);
|
||||
}
|
||||
|
||||
Handle Get1Resource(UInt32 resID, int index)
|
||||
@@ -66,8 +76,9 @@ OSErr ResError()
|
||||
|
||||
short FSpOpenResFile(const FSSpec *spec, int permission)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return 0;
|
||||
PortabilityLayer::ResourceManager *rm = PortabilityLayer::ResourceManager::GetInstance();
|
||||
|
||||
return rm->OpenResFork(static_cast<PortabilityLayer::EVirtualDirectory>(spec->parID), PLPasStr(spec->name));
|
||||
}
|
||||
|
||||
void CloseResFile(short refNum)
|
||||
|
||||
@@ -1,7 +1,70 @@
|
||||
#include "PLStringCompare.h"
|
||||
#include "PLStringCompare.h"
|
||||
#include "MacLatin.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
Boolean EqualString(const PLPasStr &string1, const PLPasStr &string2, Boolean caseSensitive, Boolean diacriticSensitive)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return false;
|
||||
}
|
||||
{
|
||||
const size_t len = string1.Length();
|
||||
if (len != string2.Length())
|
||||
return PL_FALSE;
|
||||
|
||||
const uint8_t *chars1 = string1.UChars();
|
||||
const uint8_t *chars2 = string2.UChars();
|
||||
|
||||
if (caseSensitive)
|
||||
{
|
||||
// Case sensitive
|
||||
if (diacriticSensitive)
|
||||
{
|
||||
// Diacritic sensitive
|
||||
return memcmp(chars1, chars2, len) ? PL_FALSE : PL_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Diacritic insensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = chars1[i];
|
||||
const uint8_t c2 = chars2[i];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_stripDiacritic[c1] != PortabilityLayer::MacLatin::g_stripDiacritic[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case insensitive
|
||||
if (diacriticSensitive)
|
||||
{
|
||||
// Diacritic sensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = chars1[i];
|
||||
const uint8_t c2 = chars2[i];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_toLower[c1] != PortabilityLayer::MacLatin::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Diacritic insensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = PortabilityLayer::MacLatin::g_stripDiacritic[chars1[i]];
|
||||
const uint8_t c2 = PortabilityLayer::MacLatin::g_stripDiacritic[chars2[i]];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_toLower[c1] != PortabilityLayer::MacLatin::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,11 @@
|
||||
<ClInclude Include="DisplayDeviceManager.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="FilePermission.h" />
|
||||
<ClInclude Include="FilePos.h" />
|
||||
<ClInclude Include="GpAppInterface.h" />
|
||||
<ClInclude Include="HostAudioChannel.h" />
|
||||
<ClInclude Include="HostAudioDriver.h" />
|
||||
<ClInclude Include="HostDirectoryCursor.h" />
|
||||
<ClInclude Include="HostMutex.h" />
|
||||
<ClInclude Include="HostSuspendCallArgument.h" />
|
||||
<ClInclude Include="HostSuspendCallID.h" />
|
||||
@@ -147,6 +149,7 @@
|
||||
<ClInclude Include="MacFileMem.h" />
|
||||
<ClInclude Include="MacFileInfo.h" />
|
||||
<ClInclude Include="MacFileWriteableMem.h" />
|
||||
<ClInclude Include="MacLatin.h" />
|
||||
<ClInclude Include="MacRsrcHeader.h" />
|
||||
<ClInclude Include="MacRsrcMap.h" />
|
||||
<ClInclude Include="MemoryManager.h" />
|
||||
@@ -235,6 +238,7 @@
|
||||
<ClCompile Include="MacBinary2.cpp" />
|
||||
<ClCompile Include="MacFileInfo.cpp" />
|
||||
<ClCompile Include="MacFileMem.cpp" />
|
||||
<ClCompile Include="MacLatin1.cpp" />
|
||||
<ClCompile Include="MemoryManager.cpp" />
|
||||
<ClCompile Include="MemReaderStream.cpp" />
|
||||
<ClCompile Include="MMBlock.cpp" />
|
||||
|
||||
@@ -315,6 +315,15 @@
|
||||
<ClInclude Include="HostThreadEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HostDirectoryCursor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MacLatin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FilePos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CFileStream.cpp">
|
||||
@@ -467,5 +476,8 @@
|
||||
<ClCompile Include="HostAudioDriver.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MacLatin1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -16,7 +16,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
static void Encode(int32_t id, char *chars);
|
||||
static int32_t Decode(char *chars);
|
||||
static int32_t Decode(const char *chars);
|
||||
};
|
||||
|
||||
template<>
|
||||
@@ -24,7 +24,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
public:
|
||||
static void Encode(int32_t id, char *chars);
|
||||
static int32_t Decode(char *chars);
|
||||
static int32_t Decode(const char *chars);
|
||||
};
|
||||
|
||||
typedef ResTypeIDCodecResolver<'abcd'> ResTypeIDCodec;
|
||||
@@ -40,7 +40,7 @@ namespace PortabilityLayer
|
||||
chars[3] = static_cast<char>((id >> 24) & 0xff);
|
||||
}
|
||||
|
||||
inline int32_t ResTypeIDCodecResolver<0x64636261>::Decode(char *chars)
|
||||
inline int32_t ResTypeIDCodecResolver<0x64636261>::Decode(const char *chars)
|
||||
{
|
||||
return static_cast<int32_t>(
|
||||
((chars[0] & 0xff) << 0)
|
||||
@@ -57,7 +57,7 @@ namespace PortabilityLayer
|
||||
chars[3] = static_cast<char>((id >> 0) & 0xff);
|
||||
}
|
||||
|
||||
inline int32_t ResTypeIDCodecResolver<0x61626364>::Decode(char *chars)
|
||||
inline int32_t ResTypeIDCodecResolver<0x61626364>::Decode(const char *chars)
|
||||
{
|
||||
return static_cast<int32_t>(
|
||||
((chars[0] & 0xff) << 24)
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
#ifndef __PL_VIRTUALDIRECTORY_H__
|
||||
#define __PL_VIRTUALDIRECTORY_H__
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
enum EVirtualDirectory
|
||||
{
|
||||
EVirtualDirectory_ApplicationData = 1,
|
||||
EVirtualDirectory_GameData,
|
||||
EVirtualDirectory_Prefs,
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
enum EVirtualDirectory
|
||||
{
|
||||
EVirtualDirectory_Unspecified = 0,
|
||||
|
||||
EVirtualDirectory_ApplicationData = 1,
|
||||
EVirtualDirectory_GameData,
|
||||
EVirtualDirectory_UserData,
|
||||
EVirtualDirectory_Prefs,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user