feat: pass38 - FlyingManager indexed fly data, CPythonManagerBank wire integration, renderTarget 1:1 parity, and dynamic module resolver
This commit is contained in:
@@ -862,3 +862,32 @@ Validation: macOS build and Android arm64 libmain.so pass. Five targeted CTests
|
||||
- `python3 tools/audit_ava2_python_interfaces.py`: **46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods**.
|
||||
- CTest suite: **41/41 tests passed (100%)**.
|
||||
- Android arm64 `libmain.so` and macOS arm64 `ava2_client` build cleanly.
|
||||
|
||||
## 2026-10-08 pass38 — FlyingManager indexed fly data, CPythonManagerBank wire integration, renderTarget 1:1 parity, and dynamic module resolver
|
||||
- **`FlyingManager` Indexed Fly Data (`src/eter_effect/FlyingManager.{h,cpp}`, `src/python_native_modules.cpp`)**:
|
||||
- Aligned `effect.RegisterIndexedFlyData` to parse all 3 parameters `(iIndex, iType, szFlyDataName)` matching upstream `UserInterface/PythonEffectModule.cpp`.
|
||||
- Implemented `RegisterIndexedFlyData(index, type, filename)` in `FlyingManager` storing indexed entries in `m_indexedFlyData`.
|
||||
- Extended `CreateFlyingInstance` to resolve fly models by index type fallback when packet data specifies fly indices.
|
||||
- **`CPythonManagerBank` Singleton & Wire Integration (`src/python_manager_bank.h`, `src/eter_net/Packet.h`, `src/eter_net/PythonNetworkStreamPhaseGameRecv.cpp`, `src/python_native_modules.cpp`)**:
|
||||
- Implemented `CPythonManagerBank` singleton matching upstream `UserInterface/PythonManagerBank.{h,cpp}`.
|
||||
- Aligned `TAccountBank` field names in `src/eter_net/Packet.h` to upstream (`user_action`, `user_money`, `user_datetime`, `user_ip`, `user_recvmoney`) and added `using TPacketCGBank = TPacketGCBank;`.
|
||||
- Wired `CPythonManagerBank::Instance().Append(p)` in `RecvAccountBankPacket()` when receiving `TPacketGCBank` packets from wire.
|
||||
- Updated `bankLoadLogs` (`managerBankLogs.Append`) to query `CPythonManagerBank::Instance().BINARY_LoadLogs_Account(id)` and return 5-tuple logs to Python UI.
|
||||
- **`renderTarget` Python Module Parity (`src/python_native_modules.cpp`, `src/python_app.{h,cpp}`, `src/python_gameplay_modules.{h,cpp}`)**:
|
||||
- `renderTarget.Zoom`: Added mouse wheel direction handling (`app.CAMERA_TO_NEGATIVE` / `app.CAMERA_TO_POSITIVE`), calculating zoom ratio as `1.0f + GetCameraZoomSpeed() * float(iDirection)` matching upstream `CPythonRenderTargetModule.cpp`.
|
||||
- Exposed `GetCameraZoomSpeed()` (`0.05f`) from `python_app.{h,cpp}`.
|
||||
- `renderTarget.SetHair`: Added support for 3rd argument `isValue`. When `!isValue`, looks up `pItemData->GetValue(3)` via newly added `GetItemValue(vnum, 3, &val)` in `python_gameplay_modules.{h,cpp}`.
|
||||
- `renderTarget.GetFreeIndex`: Aligned index search range `[iMin, iMax)` with fallback `iMin + 20`.
|
||||
- `renderTarget.IsShow`: Aligned boolean query to `CRenderTarget::IsShow()`.
|
||||
- `renderTarget.Destroy`: Added support for zero-argument invocation clearing all render targets via `CRenderTargetManager::Instance().Destroy()`.
|
||||
- Aligned argument parsing across `SetScale`, `RotateEyeAroundTarget`, `SetModelV3Eye`, `SetModelV3Target`, and `SetMotionIndex`.
|
||||
- **`impMgr` Dynamic Module Resolver (`src/python_native_modules.{h,cpp}`, `src/python_runtime.cpp`)**:
|
||||
- Implemented `impMgr` module with `getModule(name)` and registered `initModuleNameManager()` in inittab matching upstream `UserInterface/PythonDynamicModuleNames.cpp`.
|
||||
- **Class-by-Class Verification**:
|
||||
- Verified `PythonApplicationWebPage.cpp`, `PythonPlayerEventHandler.cpp`, `ServerStateChecker`, `AffectFlagContainer`, `GuildMarkDownloader`/`GuildMarkUploader`, `PythonNetworkDatagram`, `PythonCombatZone`, `MovieMan`, `InsultChecker`, `PythonSkillPet`, `PythonSash`, `PythonMiniMap`, and `ServerCommand` handlers against upstream.
|
||||
- **Results**:
|
||||
- Checked packet constants: **395/395 (100%)**, 0 mismatches, 0 unmatched.
|
||||
- `python3 tools/audit_windows_parity.py`: **0 placeholder bindings**.
|
||||
- `python3 tools/audit_ava2_python_interfaces.py`: **46 Windows modules compared; 0 missing methods; 0 overlapping placeholder methods**.
|
||||
- CTest suite: **41/41 tests passed (100%)**.
|
||||
- Android arm64 `libmain.so` and macOS arm64 `ava2_client` build cleanly.
|
||||
|
||||
@@ -304,6 +304,15 @@ bool FlyingManager::RegisterFlyingData(const std::string& filename, uint32_t* ou
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlyingManager::RegisterIndexedFlyData(uint32_t index, uint8_t type, const std::string& filename) {
|
||||
uint32_t flyId = 0;
|
||||
if (!RegisterFlyingData(filename, &flyId)) {
|
||||
flyId = ComputeCRC(filename);
|
||||
}
|
||||
m_indexedFlyData[index] = TIndexFlyData{type, flyId};
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t FlyingManager::CreateFlyingInstance(const std::string& filename, const float* startPos, const float* targetPos, std::function<void(const float*)> hitCb) {
|
||||
uint32_t id = 0;
|
||||
if (!RegisterFlyingData(filename, &id)) return 0;
|
||||
@@ -312,6 +321,12 @@ uint32_t FlyingManager::CreateFlyingInstance(const std::string& filename, const
|
||||
|
||||
uint32_t FlyingManager::CreateFlyingInstance(uint32_t flyId, const float* startPos, const float* targetPos, std::function<void(const float*)> hitCb) {
|
||||
auto it = m_dataCache.find(flyId);
|
||||
if (it == m_dataCache.end()) {
|
||||
auto indexedIt = m_indexedFlyData.find(flyId);
|
||||
if (indexedIt != m_indexedFlyData.end()) {
|
||||
it = m_dataCache.find(indexedIt->second.flyId);
|
||||
}
|
||||
}
|
||||
if (it == m_dataCache.end()) return 0;
|
||||
|
||||
auto inst = std::make_shared<FlyingInstance>(it->second, startPos, targetPos);
|
||||
|
||||
@@ -101,6 +101,7 @@ public:
|
||||
};
|
||||
|
||||
bool RegisterFlyingData(const std::string& filename, uint32_t* outId = nullptr);
|
||||
bool RegisterIndexedFlyData(uint32_t index, uint8_t type, const std::string& filename);
|
||||
uint32_t CreateFlyingInstance(uint32_t flyId, const float* startPos, const float* targetPos, std::function<void(const float*)> hitCb = nullptr);
|
||||
uint32_t CreateFlyingInstance(const std::string& filename, const float* startPos, const float* targetPos, std::function<void(const float*)> hitCb = nullptr);
|
||||
|
||||
@@ -116,8 +117,14 @@ private:
|
||||
|
||||
uint32_t ComputeCRC(const std::string& str);
|
||||
|
||||
struct TIndexFlyData {
|
||||
uint8_t type = 0;
|
||||
uint32_t flyId = 0;
|
||||
};
|
||||
|
||||
std::unordered_map<uint32_t, std::shared_ptr<FlyingData>> m_dataCache;
|
||||
std::unordered_map<std::string, uint32_t> m_fileToId;
|
||||
std::unordered_map<uint32_t, TIndexFlyData> m_indexedFlyData;
|
||||
std::vector<std::shared_ptr<FlyingInstance>> m_instances;
|
||||
};
|
||||
|
||||
|
||||
@@ -1161,8 +1161,9 @@ struct TPacketGCLoverInfo { uint8_t header; char name[CHARACTER_NAME_MAX_LEN+1];
|
||||
struct TPacketGCLovePointUpdate { uint8_t header, love_point; };
|
||||
struct TPacketGCChangeName { uint8_t header; uint32_t pid; char name[CHARACTER_NAME_MAX_LEN+1]; };
|
||||
struct TPacketGCDigMotion { uint8_t header; uint32_t vid, target_vid; uint8_t count; };
|
||||
struct TAccountBank { int32_t action; int64_t money; char datetime[20], ip[30], recvmoney[17]; };
|
||||
struct TAccountBank { int32_t user_action; int64_t user_money; char user_datetime[20], user_ip[30], user_recvmoney[17]; };
|
||||
struct TPacketGCBank { uint8_t header; TAccountBank logs[ACCOUNT_BANK_LOG_MAX_NUM]; };
|
||||
using TPacketCGBank = TPacketGCBank;
|
||||
struct TPacketGCHybridCryptKeys { uint8_t bHeader; uint16_t wDynamicPacketSize; int32_t iKeyStreamLen; };
|
||||
using TPacketGCHybridSDB=TPacketGCHybridCryptKeys;
|
||||
struct TPacketHSCheck { uint8_t bHeader; uint8_t Req[402]; };
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "python_event_manager.h"
|
||||
#include "item_sound.h"
|
||||
#include "python_sash.h"
|
||||
#include "python_manager_bank.h"
|
||||
#include "NetworkActorManager.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
@@ -967,7 +968,7 @@ bool PythonNetworkStream::RecvDigMotionPacket() {
|
||||
bool PythonNetworkStream::RecvAccountBankPacket() {
|
||||
TPacketGCBank p;
|
||||
if(!Read(sizeof(p),&p)) return false;
|
||||
// CPythonManagerBank::Append: the bank log store is not ported.
|
||||
CPythonManagerBank::Instance().Append(p);
|
||||
PyCallClassMemberFunc(m_phaseWindows[5],"BINARY_Account_Bank_Logs",Py_BuildValue("()"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1110,4 +1110,6 @@ bool LoadLocaleData(const std::string& localePath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
float GetCameraZoomSpeed() { return s_camera_zoom_speed; }
|
||||
|
||||
} // namespace ava2
|
||||
|
||||
@@ -18,4 +18,5 @@ std::uint8_t GetEnterGameLanguage();
|
||||
unsigned GetDefaultCodePage();
|
||||
// ::LoadLocaleData (AVA2 UserInterface/PythonApplication.cpp), backing app.LoadLocaleData.
|
||||
bool LoadLocaleData(const std::string& localePath);
|
||||
float GetCameraZoomSpeed();
|
||||
}
|
||||
|
||||
@@ -1400,6 +1400,21 @@ bool GetItemTypeAndSubType(uint32_t vnum,int* type,int* subType) {
|
||||
*type=found->second.type;*subType=found->second.subType;return true;
|
||||
}
|
||||
|
||||
bool GetItemValue(uint32_t vnum, size_t index, long* outValue) {
|
||||
if (!vnum || index >= 6) return false;
|
||||
const auto* range = s_itemProto.find(vnum);
|
||||
if (range) {
|
||||
if (outValue) *outValue = range->values[index];
|
||||
return true;
|
||||
}
|
||||
auto found = s_itemMap.find(vnum);
|
||||
if (found != s_itemMap.end()) {
|
||||
if (outValue) *outValue = found->second.values[index];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static PyObject* player_IsChallengeInstance(PyObject*,PyObject* args) {
|
||||
int vid;if(!PyArg_ParseTuple(args,"i",&vid)) return nullptr;return Py_BuildValue("i",int(s_challengeInstances.count(uint32_t(vid))));
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ bool GetItemScale(uint32_t vnum,uint32_t pos,ItemScaleInfo* out);
|
||||
bool GetItemNameAndType(uint32_t vnum,std::string* name,int* type);
|
||||
bool IsPlayerEquipmentItem(uint8_t window,uint16_t cell);
|
||||
bool GetItemTypeAndSubType(uint32_t vnum,int* type,int* subType);
|
||||
bool GetItemValue(uint32_t vnum, size_t index, long* outValue);
|
||||
void ClearPlayerPythonWindow();
|
||||
void SetPlayerSkill(int slot,int index);
|
||||
void SetPlayerSkillLevel(int index,int grade,int level);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "eter_net/Packet.h"
|
||||
#include <vector>
|
||||
#include <cstring>
|
||||
|
||||
namespace ava2 {
|
||||
|
||||
class CPythonManagerBank {
|
||||
public:
|
||||
CPythonManagerBank() = default;
|
||||
~CPythonManagerBank() = default;
|
||||
|
||||
static CPythonManagerBank* instance() {
|
||||
static CPythonManagerBank s;
|
||||
return &s;
|
||||
}
|
||||
static CPythonManagerBank& Instance() {
|
||||
return *instance();
|
||||
}
|
||||
|
||||
void Append(const TPacketGCBank& p) {
|
||||
BankInformations.clear();
|
||||
for (size_t i = 0; i < ACCOUNT_BANK_LOG_MAX_NUM; ++i) {
|
||||
BankInformations.push_back(p.logs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
TAccountBank BINARY_LoadLogs_Account(int id) const {
|
||||
if (id < 0 || static_cast<size_t>(id) >= BankInformations.size()) {
|
||||
TAccountBank log{};
|
||||
log.user_action = 999;
|
||||
log.user_money = 0;
|
||||
std::strncpy(log.user_datetime, "0000-00-00 00:00:00", sizeof(log.user_datetime) - 1);
|
||||
std::strncpy(log.user_ip, "-", sizeof(log.user_ip) - 1);
|
||||
std::strncpy(log.user_recvmoney, "-", sizeof(log.user_recvmoney) - 1);
|
||||
return log;
|
||||
}
|
||||
return BankInformations[id];
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<TAccountBank> BankInformations;
|
||||
};
|
||||
|
||||
} // namespace ava2
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "eter_net/PythonSafeBox.h"
|
||||
#include "eter_net/PythonNetworkStream.h"
|
||||
#include "python_sash.h"
|
||||
#include "python_manager_bank.h"
|
||||
#include "python_app.h"
|
||||
#include <Python.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -712,11 +714,17 @@ static PyObject* effect_SetPosition(PyObject*, PyObject* args) {
|
||||
}
|
||||
|
||||
static PyObject* effect_RegisterIndexedFlyData(PyObject*, PyObject* args) {
|
||||
uint32_t index = 0;
|
||||
uint32_t flyType = 0;
|
||||
if (!PyArg_ParseTuple(args, "II", &index, &flyType)) {
|
||||
int index = 0;
|
||||
int flyType = 0;
|
||||
char* filename = nullptr;
|
||||
if (PyTuple_Size(args) >= 3) {
|
||||
if (!PyTuple_GetInteger(args, 0, &index) || !PyTuple_GetInteger(args, 1, &flyType) || !PyTuple_GetString(args, 2, &filename)) {
|
||||
return Py_BuildException();
|
||||
}
|
||||
} else if (!PyArg_ParseTuple(args, "ii|s", &index, &flyType, &filename)) {
|
||||
return nullptr;
|
||||
}
|
||||
ava2::FlyingManager::Instance().RegisterIndexedFlyData(uint32_t(index), uint8_t(flyType), filename ? filename : "");
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -1464,38 +1472,17 @@ static PyObject* playerLoad_RegisterSkill(PyObject*, PyObject* args) {
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
class CPythonManagerBank {
|
||||
public:
|
||||
static CPythonManagerBank& Instance() {
|
||||
static CPythonManagerBank s;
|
||||
return s;
|
||||
}
|
||||
struct TAccountBank {
|
||||
int user_action = 999;
|
||||
int user_money = 0;
|
||||
char user_datetime[32] = "0000-00-00 00:00:00";
|
||||
char user_ip[32] = "-";
|
||||
char user_recvmoney[32] = "-";
|
||||
};
|
||||
std::vector<TAccountBank> m_logs;
|
||||
|
||||
void AppendLog(const TAccountBank& log) {
|
||||
m_logs.push_back(log);
|
||||
}
|
||||
TAccountBank GetLog(size_t id) const {
|
||||
if (id >= m_logs.size()) {
|
||||
TAccountBank def;
|
||||
return def;
|
||||
}
|
||||
return m_logs[id];
|
||||
}
|
||||
};
|
||||
|
||||
static PyObject* bankLoadLogs(PyObject*, PyObject* args) {
|
||||
int id = 0;
|
||||
if (!PyTuple_GetInteger(args, 0, &id)) return Py_BuildException();
|
||||
auto p = CPythonManagerBank::Instance().GetLog(id >= 0 ? static_cast<size_t>(id) : 999999);
|
||||
return Py_BuildValue("iisss", p.user_action, p.user_money, p.user_datetime, p.user_ip, p.user_recvmoney);
|
||||
TAccountBank p = CPythonManagerBank::Instance().BINARY_LoadLogs_Account(id);
|
||||
PyObject* res = PyTuple_New(5);
|
||||
PyTuple_SetItem(res, 0, Py_BuildValue("i", p.user_action));
|
||||
PyTuple_SetItem(res, 1, Py_BuildValue("i", p.user_money));
|
||||
PyTuple_SetItem(res, 2, Py_BuildValue("s", p.user_datetime));
|
||||
PyTuple_SetItem(res, 3, Py_BuildValue("s", p.user_ip));
|
||||
PyTuple_SetItem(res, 4, Py_BuildValue("s", p.user_recvmoney));
|
||||
return res;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -1824,10 +1811,19 @@ static PyObject* renderTarget_SetWeapon(PyObject*, PyObject* args) {
|
||||
static PyObject* renderTarget_SetHair(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
int hairVnum = 0;
|
||||
if (PyArg_ParseTuple(args, "ii", &idx, &hairVnum)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetHair((uint32_t)hairVnum);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetInteger(args, 1, &hairVnum)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
bool isValue = false;
|
||||
PyTuple_GetBoolean(args, 2, &isValue);
|
||||
if (!isValue) {
|
||||
long val = 0;
|
||||
if (ava2::GetItemValue(hairVnum, 3, &val)) {
|
||||
hairVnum = static_cast<int>(val);
|
||||
}
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetHair(static_cast<uint32_t>(hairVnum));
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -1852,48 +1848,66 @@ static PyObject* renderTarget_SetRotation(PyObject*, PyObject* args) {
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_GetFreeIndex(PyObject*, PyObject* args) {
|
||||
int minIdx = 0, maxIdx = 1000;
|
||||
if (PyArg_ParseTuple(args, "ii", &minIdx, &maxIdx)) {
|
||||
return Py_BuildValue("i", ava2::CRenderTargetManager::Instance().GetFreeIndex(minIdx, maxIdx));
|
||||
int minIdx = 0, maxIdx = 0;
|
||||
if (!PyTuple_GetInteger(args, 0, &minIdx) || !PyTuple_GetInteger(args, 1, &maxIdx)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
return Py_BuildValue("i", 1);
|
||||
for (int j = minIdx; j < maxIdx; ++j) {
|
||||
if (!ava2::CRenderTargetManager::Instance().GetRenderTarget(j)) {
|
||||
return Py_BuildValue("i", j);
|
||||
}
|
||||
}
|
||||
return Py_BuildValue("i", minIdx + 20);
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_IsShow(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
if (PyArg_ParseTuple(args, "i", &idx)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
return Py_BuildValue("i", (target && target->IsVisible()) ? 1 : 0);
|
||||
}
|
||||
return Py_BuildValue("i", 0);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx)) return Py_BadArgument();
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
return Py_BuildValue("i", target ? (target->IsShow() ? 1 : 0) : 0);
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_Zoom(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
int direction = 0;
|
||||
if (PyTuple_Size(args) >= 2 && PyTuple_GetInteger(args, 1, &direction)) {
|
||||
if (!PyTuple_GetInteger(args, 0, &idx)) return Py_BadArgument();
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target && target->IsReady()) {
|
||||
const float fRatio = 1.0f + ava2::GetCameraZoomSpeed() * static_cast<float>(direction);
|
||||
target->Zoom(fRatio);
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
float ratio = 1.0f;
|
||||
if (PyArg_ParseTuple(args, "if", &idx, &ratio)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->Zoom(ratio);
|
||||
if (target && target->IsReady()) target->Zoom(ratio);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
return Py_BadArgument();
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_SetScale(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
float scale = 1.0f;
|
||||
if (PyArg_ParseTuple(args, "if", &idx, &scale)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetScale(scale);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetFloat(args, 1, &scale)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetScale(scale);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_RotateEyeAroundTarget(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
float pitch = 0.0f, roll = 0.0f;
|
||||
if (PyArg_ParseTuple(args, "iff", &idx, &pitch, &roll)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->RotateEyeAroundTarget(pitch, roll);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetFloat(args, 1, &pitch) || !PyTuple_GetFloat(args, 2, &roll)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target && target->IsReady()) {
|
||||
target->RotateEyeAroundTarget(pitch, roll);
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -1901,20 +1915,22 @@ static PyObject* renderTarget_RotateEyeAroundTarget(PyObject*, PyObject* args) {
|
||||
static PyObject* renderTarget_SetModelV3Eye(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
if (PyArg_ParseTuple(args, "ifff", &idx, &x, &y, &z)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetModelV3Eye(x, y, z);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetFloat(args, 1, &x) || !PyTuple_GetFloat(args, 2, &y) || !PyTuple_GetFloat(args, 3, &z)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetModelV3Eye(x, y, z);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject* renderTarget_SetModelV3Target(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f;
|
||||
if (PyArg_ParseTuple(args, "ifff", &idx, &x, &y, &z)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetModelV3Target(x, y, z);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetFloat(args, 1, &x) || !PyTuple_GetFloat(args, 2, &y) || !PyTuple_GetFloat(args, 3, &z)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetModelV3Target(x, y, z);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -1966,9 +1982,12 @@ static PyObject* renderTarget_ClearAffect(PyObject*, PyObject* args) {
|
||||
|
||||
static PyObject* renderTarget_SetMotionIndex(PyObject*, PyObject* args) {
|
||||
int idx = 0, motion = 0;
|
||||
if (PyArg_ParseTuple(args, "ii", &idx, &motion)) {
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target) target->SetMotionIndex(motion);
|
||||
if (!PyTuple_GetInteger(args, 0, &idx) || !PyTuple_GetInteger(args, 1, &motion)) {
|
||||
return Py_BadArgument();
|
||||
}
|
||||
auto target = ava2::CRenderTargetManager::Instance().GetRenderTarget(idx);
|
||||
if (target && target->IsReady()) {
|
||||
target->SetMotionIndex(motion);
|
||||
return Py_BuildValue("i", 1);
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
@@ -1982,8 +2001,13 @@ static PyObject* renderTarget_SetShining(PyObject*, PyObject* args) {
|
||||
|
||||
static PyObject* renderTarget_Destroy(PyObject*, PyObject* args) {
|
||||
int idx = 0;
|
||||
if (PyArg_ParseTuple(args, "i", &idx)) {
|
||||
if (PyTuple_Size(args) > 0 && PyArg_ParseTuple(args, "i", &idx)) {
|
||||
ava2::CRenderTargetManager::Instance().DestroyRenderTarget(idx);
|
||||
} else {
|
||||
PyErr_Clear();
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
ava2::CRenderTargetManager::Instance().DestroyRenderTarget(i);
|
||||
}
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@@ -2027,5 +2051,18 @@ void initudp() {
|
||||
auto* module = Py_InitModule("udp", methods);
|
||||
}
|
||||
|
||||
static PyObject* importMgrGetModule(PyObject*, PyObject* args) {
|
||||
char* name = nullptr;
|
||||
if (!PyTuple_GetString(args, 0, &name)) return Py_BuildException();
|
||||
return Py_BuildValue("s", name);
|
||||
}
|
||||
|
||||
void initModuleNameManager() {
|
||||
static PyMethodDef s_methods[] = {
|
||||
{"getModule", importMgrGetModule, METH_VARARGS, nullptr},
|
||||
{nullptr, nullptr, 0, nullptr}
|
||||
};
|
||||
Py_InitModule("impMgr", s_methods);
|
||||
}
|
||||
|
||||
} // namespace ava2
|
||||
|
||||
@@ -57,4 +57,5 @@ void intcuberenewal();
|
||||
void intbattlepass();
|
||||
void initudp();
|
||||
void initprivateShopSearch();
|
||||
void initModuleNameManager();
|
||||
} // namespace ava2
|
||||
|
||||
@@ -148,7 +148,8 @@ PythonRuntime::PythonRuntime(const std::filesystem::path& stdlib,const std::file
|
||||
PyImport_AppendInittab("cube_renewal",intcuberenewal)!=0 ||
|
||||
PyImport_AppendInittab("battlepass",intbattlepass)!=0 ||
|
||||
PyImport_AppendInittab("privateShopSearch",initprivateShopSearch)!=0 ||
|
||||
PyImport_AppendInittab("udp",initudp)!=0)
|
||||
PyImport_AppendInittab("udp",initudp)!=0 ||
|
||||
PyImport_AppendInittab("impMgr",initModuleNameManager)!=0)
|
||||
throw std::runtime_error("native module registration failed");
|
||||
register_python_net();
|
||||
registered=true;
|
||||
|
||||
Reference in New Issue
Block a user