Skip to content

Commit

Permalink
core 1.0.0.4
Browse files Browse the repository at this point in the history
fix makejson structureReturn for unreferenced class
remove unusing internal elementminus
  • Loading branch information
karikera committed Jan 19, 2021
1 parent 5749472 commit e0050dd
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "node-chakracore"]
path = node-chakracore
url = https://github.com/karikera/node-chakracore
[submodule "elementminus"]
path = elementminus
url = https://github.com/karikera/elementminus.git
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ It's the core for [bdsx](https://github.com/karikera/bdsx)
[NASM](https://www.nasm.us/) & Set PATH - required by node-chakracore
[Python2.x](https://www.python.org/downloads/release/python-2718/) & Set PATH - required by node-chakracore

1. Clone bdsx-core, bdsx, ken(ken is a personal library project)
1. Clone bdsx-core, elementminus, ken
**[parent directory]**
├ ken (https://github.com/karikera/ken)
├ ken (https://github.com/karikera/ken) - personal library project
├ elementminus (https://github.com/karikera/elementminus) - dll injecter for BDS
└ bdsx-core (https://github.com/karikera/bdsx-core)

2. Update git submodules.
Expand Down
49 changes: 38 additions & 11 deletions bdsx/makefunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ namespace
JsPropertyId pnullableReturn = u"nullableReturn";
JsPropertyId pnullableThis = u"nullableThis";
JsPropertyId pnullableParams = u"nullableParams";
JsPropertyId pnativeDebugBreak = u"nativeDebugBreak";
#ifndef NDEBUG
JsPropertyId pnativeDebugBreakOnMake = u"nativeDebugBreakOnMake";
#endif
};
Deferred<DeferField> s_field(JsRuntime::initpack);

Expand Down Expand Up @@ -361,11 +365,19 @@ namespace

JsValueRef js_pointer_new(JsValueRef ctor, JsValueRef* out) noexcept
{
JsValue ctorv = JsClass((JsRawData)ctor).newInstanceRaw({JsValue(true)});
*out = ctorv.getRaw();
try
{
JsValue ctorv = JsClass((JsRawData)ctor).newInstanceRaw({ JsValue(true) });
*out = ctorv.getRaw();

VoidPointer* nptr = ctorv.getNativeObject<VoidPointer>();
return nptr->getAddressRaw();
VoidPointer* nptr = ctorv.getNativeObject<VoidPointer>();
return nptr->getAddressRaw();
}
catch (JsException& err)
{
JsSetException(err.getValue().getRaw());
}
getout(JsErrorScriptException);
}

int64_t bin64(JsValueRef value, uint32_t paramNum) noexcept
Expand Down Expand Up @@ -405,8 +417,8 @@ namespace
catch (JsException& err)
{
JsSetException(err.getValue().getRaw());
return nullptr;
}
getout(JsErrorScriptException);
}
JsValueRef np2js_wrapper_nullable(void* ptr, JsValueRef func, JsValueRef ctor) noexcept
{
Expand All @@ -428,8 +440,8 @@ namespace
catch (JsException& err)
{
JsSetException(err.getValue().getRaw());
return nullptr;
}
getout(JsErrorScriptException);
}

struct FunctionTable
Expand Down Expand Up @@ -633,6 +645,7 @@ namespace
bool nullableReturn;
bool useThis;
bool nullableParams;
bool nativeDebugBreak;
JsValue thisType;

TmpArray<RawTypeId> typeIds;
Expand All @@ -656,6 +669,13 @@ namespace
nullableReturn = opts.get(s_field->pnullableReturn).cast<bool>();
nullableThis = opts.get(s_field->pnullableThis).cast<bool>();
nullableParams = opts.get(s_field->pnullableParams).cast<bool>();
nativeDebugBreak = opts.get(s_field->pnativeDebugBreak).cast<bool>();
#ifndef NDEBUG
if (opts.get(s_field->pnativeDebugBreakOnMake).cast<bool>())
{
debug();
}
#endif
if (useThis)
{
if (!thisType.prototypeOf(VoidPointer::classObject))
Expand All @@ -679,10 +699,12 @@ namespace
}
else
{
structureReturn = 0;
useThis = 0;
nullableReturn = 0;
nullableThis = 0;
structureReturn = false;
useThis = false;
nullableReturn = false;
nullableThis = false;
nullableParams = false;
nativeDebugBreak = false;
}

countOnCalling = countOnMaking == PARAM_OFFSET - 1 ? 0 : countOnMaking - PARAM_OFFSET;
Expand Down Expand Up @@ -799,6 +821,8 @@ namespace
Maker(ParamInfoMaker& pi, size_t size, int32_t stackSize, bool useGetOut) noexcept
:JitFunction(size), pi(pi), stackSize(stackSize)
{
if (pi.nativeDebugBreak) debugBreak();

mov(RAX, (qword)&returnPoint);
mov(R10, QwordPtr, RAX);

Expand Down Expand Up @@ -1287,7 +1311,10 @@ namespace
{
case RawTypeId::StructureReturn: {
lea(RDX, RBP, offsetForStructureReturn);
mov(RCX, (qword)info.type.getRaw());

JsValueRef ref = info.type.getRaw();
JsAddRef(ref, nullptr);
mov(RCX, (qword)ref);
CALL(js_pointer_new);
_mov(target, TARGET_RETURN, RawTypeId::Void, true);
break;
Expand Down
2 changes: 1 addition & 1 deletion bdsx/version.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

set BDSX_CORE_VERSION=1.0.0.3
set BDSX_CORE_VERSION=1.0.0.4
1 change: 0 additions & 1 deletion elementminus
Submodule elementminus deleted from 30c97a

0 comments on commit e0050dd

Please sign in to comment.