mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-25 19:30:50 +00:00
use toolbox errors
This commit is contained in:
parent
528e19b1d9
commit
55a255f44f
@ -13,6 +13,7 @@
|
|||||||
#include <mplite/mplite.h>
|
#include <mplite/mplite.h>
|
||||||
|
|
||||||
using ToolBox::Log;
|
using ToolBox::Log;
|
||||||
|
using namespace ToolBox::Errors;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -5,12 +5,6 @@
|
|||||||
|
|
||||||
namespace MM
|
namespace MM
|
||||||
{
|
{
|
||||||
enum
|
|
||||||
{
|
|
||||||
memFullErr = -108,
|
|
||||||
memWZErr = -111,
|
|
||||||
};
|
|
||||||
|
|
||||||
// native functions.
|
// native functions.
|
||||||
namespace Native
|
namespace Native
|
||||||
{
|
{
|
||||||
|
@ -116,14 +116,16 @@ namespace RM
|
|||||||
uint32_t theType;
|
uint32_t theType;
|
||||||
uint32_t name;
|
uint32_t name;
|
||||||
|
|
||||||
|
uint32_t resourceHandle = 0;
|
||||||
|
|
||||||
sp = StackFrame<8>(theType, name);
|
sp = StackFrame<8>(theType, name);
|
||||||
|
|
||||||
std::string sname = ToolBox::ReadPString(name);
|
std::string sname = ToolBox::ReadPString(name);
|
||||||
|
|
||||||
Log("%04x Get1NamedResource(%08x, %s)\n", trap, theType, sname.c_str());
|
Log("%04x Get1NamedResource(%08x, %s)\n", trap, theType, sname.c_str());
|
||||||
|
|
||||||
ToolReturn<4>(sp, 0);
|
ToolReturn<4>(sp, resourceHandle);
|
||||||
return -192;
|
return SetResError(resourceHandle ? 0 : resNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +161,7 @@ namespace RM
|
|||||||
resourceHandle = GetXResource(theType, theID);
|
resourceHandle = GetXResource(theType, theID);
|
||||||
|
|
||||||
ToolReturn<4>(sp, resourceHandle);
|
ToolReturn<4>(sp, resourceHandle);
|
||||||
return resourceHandle ? 0 : -192;
|
return SetResError(resourceHandle ? 0 : resNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +196,7 @@ namespace RM
|
|||||||
resourceHandle = GetXResource(theType, theID);
|
resourceHandle = GetXResource(theType, theID);
|
||||||
|
|
||||||
ToolReturn<4>(sp, resourceHandle);
|
ToolReturn<4>(sp, resourceHandle);
|
||||||
return resourceHandle ? 0 : -192;
|
return SetResError(resourceHandle ? 0 : resNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user