From 55a255f44f27d1a812d51c3d11a1749cc5b911af Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 26 Feb 2013 18:30:25 -0500 Subject: [PATCH] use toolbox errors --- toolbox/mm.cpp | 1 + toolbox/mm.h | 6 ------ toolbox/rm.cpp | 10 ++++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/toolbox/mm.cpp b/toolbox/mm.cpp index e654b28..31fd9e3 100644 --- a/toolbox/mm.cpp +++ b/toolbox/mm.cpp @@ -13,6 +13,7 @@ #include using ToolBox::Log; +using namespace ToolBox::Errors; namespace { diff --git a/toolbox/mm.h b/toolbox/mm.h index 27d10e4..f398b30 100644 --- a/toolbox/mm.h +++ b/toolbox/mm.h @@ -5,12 +5,6 @@ namespace MM { - enum - { - memFullErr = -108, - memWZErr = -111, - }; - // native functions. namespace Native { diff --git a/toolbox/rm.cpp b/toolbox/rm.cpp index 11525ff..17da547 100644 --- a/toolbox/rm.cpp +++ b/toolbox/rm.cpp @@ -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); }