use toolbox errors

This commit is contained in:
Kelvin Sherlock 2013-02-26 18:30:25 -05:00
parent 528e19b1d9
commit 55a255f44f
3 changed files with 7 additions and 10 deletions

View File

@ -13,6 +13,7 @@
#include <mplite/mplite.h>
using ToolBox::Log;
using namespace ToolBox::Errors;
namespace
{

View File

@ -5,12 +5,6 @@
namespace MM
{
enum
{
memFullErr = -108,
memWZErr = -111,
};
// native functions.
namespace Native
{

View File

@ -116,14 +116,16 @@ namespace RM
uint32_t theType;
uint32_t name;
uint32_t resourceHandle = 0;
sp = StackFrame<8>(theType, name);
std::string sname = ToolBox::ReadPString(name);
Log("%04x Get1NamedResource(%08x, %s)\n", trap, theType, sname.c_str());
ToolReturn<4>(sp, 0);
return -192;
ToolReturn<4>(sp, resourceHandle);
return SetResError(resourceHandle ? 0 : resNotFound);
}
@ -159,7 +161,7 @@ namespace RM
resourceHandle = GetXResource(theType, theID);
ToolReturn<4>(sp, resourceHandle);
return resourceHandle ? 0 : -192;
return SetResError(resourceHandle ? 0 : resNotFound);
}
@ -194,7 +196,7 @@ namespace RM
resourceHandle = GetXResource(theType, theID);
ToolReturn<4>(sp, resourceHandle);
return resourceHandle ? 0 : -192;
return SetResError(resourceHandle ? 0 : resNotFound);
}