mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-24 05:14:40 -04:00
remove cursed this->m_
This commit is contained in:
parent
eb3b84113c
commit
07e64c4dc9
12 changed files with 123 additions and 123 deletions
bindings
loader/src
internal
loader
platform
ui
utils
|
@ -326,18 +326,18 @@ class CCLightFlash {
|
|||
|
||||
class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite {
|
||||
void useAnimationType(MenuAnimationType type) {
|
||||
this->m_startPosition = this->getNormalImage()->getPosition();
|
||||
this->m_animationType = type;
|
||||
m_startPosition = this->getNormalImage()->getPosition();
|
||||
m_animationType = type;
|
||||
}
|
||||
void setDestination(cocos2d::CCPoint const& pos) {
|
||||
this->m_destPosition = pos;
|
||||
m_destPosition = pos;
|
||||
}
|
||||
void setOffset(cocos2d::CCPoint const& pos) {
|
||||
this->m_offset = pos;
|
||||
m_offset = pos;
|
||||
}
|
||||
void setScale(float scale) {
|
||||
this->CCMenuItemSprite::setScale(scale);
|
||||
this->m_baseScale = scale;
|
||||
m_baseScale = scale;
|
||||
}
|
||||
|
||||
static CCMenuItemSpriteExtra* create(cocos2d::CCNode*, cocos2d::CCNode*, cocos2d::CCObject*, cocos2d::SEL_MenuHandler) = mac 0x1253c0, win 0x18ee0, ios 0xe0740;
|
||||
|
@ -463,11 +463,11 @@ class CCScrollLayerExt : cocos2d::CCLayer {
|
|||
}
|
||||
float getMinY() {
|
||||
return this->getContentSize().height -
|
||||
this->m_contentLayer->getContentSize().height -
|
||||
this->m_scrollLimitTop;
|
||||
m_contentLayer->getContentSize().height -
|
||||
m_scrollLimitTop;
|
||||
}
|
||||
float getMaxY() {
|
||||
return this->m_scrollLimitBottom;
|
||||
return m_scrollLimitBottom;
|
||||
}
|
||||
|
||||
// todo: add this back when CCDestructor works and
|
||||
|
@ -1048,12 +1048,12 @@ class DrawGridLayer : cocos2d::CCLayer {
|
|||
|
||||
class EditButtonBar : cocos2d::CCNode {
|
||||
void removeAllItems() {
|
||||
this->m_buttonArray->removeAllObjects();
|
||||
m_buttonArray->removeAllObjects();
|
||||
this->reloadItemsInNormalSize();
|
||||
}
|
||||
void reloadItems(int rowCount, int columnCount) {
|
||||
if (this->m_buttonArray)
|
||||
this->loadFromItems(this->m_buttonArray, rowCount, columnCount, this->m_unknown);
|
||||
if (m_buttonArray)
|
||||
this->loadFromItems(m_buttonArray, rowCount, columnCount, m_unknown);
|
||||
}
|
||||
void reloadItemsInNormalSize() {
|
||||
// TODO: fix this
|
||||
|
@ -1063,8 +1063,8 @@ class EditButtonBar : cocos2d::CCNode {
|
|||
// );
|
||||
}
|
||||
void addButton(CCMenuItemSpriteExtra* btn, bool reload) {
|
||||
if (this->m_buttonArray)
|
||||
this->m_buttonArray->addObject(btn);
|
||||
if (m_buttonArray)
|
||||
m_buttonArray->addObject(btn);
|
||||
if (reload)
|
||||
this->reloadItemsInNormalSize();
|
||||
}
|
||||
|
@ -1361,19 +1361,19 @@ class EffectGameObject : GameObject {
|
|||
void updateLabel() {
|
||||
auto label = static_cast<cocos2d::CCLabelBMFont*>(this->getChildByTag(999));
|
||||
if (label) {
|
||||
switch (this->m_objectID) {
|
||||
switch (m_objectID) {
|
||||
// instant count, collision block, pickup
|
||||
case 0x713: [[fallthrough]];
|
||||
case 0x718: [[fallthrough]];
|
||||
case 0x716:
|
||||
label->setString(
|
||||
cocos2d::CCString::createWithFormat("%i", this->m_itemBlockAID)->getCString()
|
||||
cocos2d::CCString::createWithFormat("%i", m_itemBlockAID)->getCString()
|
||||
);
|
||||
break;
|
||||
// color, pulse
|
||||
case 899: [[fallthrough]];
|
||||
case 1006: {
|
||||
int target = this->m_objectID == 1006 ? m_targetGroupID : m_targetColorID;
|
||||
int target = m_objectID == 1006 ? m_targetGroupID : m_targetColorID;
|
||||
if (target > 999) {
|
||||
label->setString(GJSpecialColorSelect::textForColorIdx(target));
|
||||
} else {
|
||||
|
@ -1385,7 +1385,7 @@ class EffectGameObject : GameObject {
|
|||
} break;
|
||||
default:
|
||||
label->setString(
|
||||
cocos2d::CCString::createWithFormat("%i", this->m_targetGroupID)->getCString()
|
||||
cocos2d::CCString::createWithFormat("%i", m_targetGroupID)->getCString()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1632,7 +1632,7 @@ class GJBaseGameLayer : cocos2d::CCLayer, TriggerEffectDelegate {
|
|||
return m_objectLayer;
|
||||
}
|
||||
cocos2d::CCArray* getAllObjects() {
|
||||
return this->m_objects;
|
||||
return m_objects;
|
||||
}
|
||||
|
||||
static GJBaseGameLayer* get() {
|
||||
|
@ -2353,10 +2353,10 @@ class GJRobotSprite : CCAnimatedSprite {
|
|||
|
||||
class GJRotationControl : cocos2d::CCLayer {
|
||||
void setAngle(float angle) {
|
||||
this->m_sliderPosition = cocos2d::CCPointMake(sinf(angle) * 60.0f, cosf(angle) * 60.0f);
|
||||
this->m_angle = angle;
|
||||
m_sliderPosition = cocos2d::CCPointMake(sinf(angle) * 60.0f, cosf(angle) * 60.0f);
|
||||
m_angle = angle;
|
||||
|
||||
this->m_sliderThumb->setPosition(this->m_sliderPosition);
|
||||
m_sliderThumb->setPosition(m_sliderPosition);
|
||||
}
|
||||
|
||||
void updateSliderPosition(cocos2d::CCPoint const& pos) = win 0x94020;
|
||||
|
@ -2408,7 +2408,7 @@ class GJScoreCell : TableViewCell {
|
|||
|
||||
class GJSearchObject : cocos2d::CCNode {
|
||||
SearchType getType() {
|
||||
return this->m_searchType;
|
||||
return m_searchType;
|
||||
}
|
||||
|
||||
static GJSearchObject* create(SearchType nID) = win 0xc2b90;
|
||||
|
@ -2468,46 +2468,46 @@ class GJUserCell : TableViewCell {
|
|||
|
||||
class GJUserScore : cocos2d::CCNode {
|
||||
IconType getIconType() const {
|
||||
return this->m_iconType;
|
||||
return m_iconType;
|
||||
}
|
||||
int getPlayerCube() const {
|
||||
return this->m_playerCube;
|
||||
return m_playerCube;
|
||||
}
|
||||
int getPlayerShip() const {
|
||||
return this->m_playerShip;
|
||||
return m_playerShip;
|
||||
}
|
||||
int getPlayerBall() const {
|
||||
return this->m_playerBall;
|
||||
return m_playerBall;
|
||||
}
|
||||
int getPlayerUfo() const {
|
||||
return this->m_playerUfo;
|
||||
return m_playerUfo;
|
||||
}
|
||||
int getPlayerWave() const {
|
||||
return this->m_playerWave;
|
||||
return m_playerWave;
|
||||
}
|
||||
int getPlayerRobot() const {
|
||||
return this->m_playerRobot;
|
||||
return m_playerRobot;
|
||||
}
|
||||
int getPlayerSpider() const {
|
||||
return this->m_playerSpider;
|
||||
return m_playerSpider;
|
||||
}
|
||||
int getPlayerStreak() const {
|
||||
return this->m_playerStreak;
|
||||
return m_playerStreak;
|
||||
}
|
||||
bool getGlowEnabled() const {
|
||||
return this->m_glowEnabled;
|
||||
return m_glowEnabled;
|
||||
}
|
||||
int getPlayerExplosion() const {
|
||||
return this->m_playerExplosion;
|
||||
return m_playerExplosion;
|
||||
}
|
||||
int getPlayerColor1() const {
|
||||
return this->m_color1;
|
||||
return m_color1;
|
||||
}
|
||||
int getPlayerColor2() const {
|
||||
return this->m_color2;
|
||||
return m_color2;
|
||||
}
|
||||
gd::string getPlayerName() const {
|
||||
return this->m_userName;
|
||||
return m_userName;
|
||||
}
|
||||
static GJUserScore* create() = win 0xc1660;
|
||||
static GJUserScore* create(cocos2d::CCDictionary*) = win 0xc0750;
|
||||
|
@ -4991,10 +4991,10 @@ class SimplePlayer : cocos2d::CCSprite {
|
|||
|
||||
class Slider : cocos2d::CCLayer {
|
||||
void setValue(float val) {
|
||||
this->m_touchLogic->getThumb()->setValue(val);
|
||||
m_touchLogic->getThumb()->setValue(val);
|
||||
}
|
||||
void setBarVisibility(bool v) {
|
||||
this->m_sliderBar->setVisible(v);
|
||||
m_sliderBar->setVisible(v);
|
||||
}
|
||||
static Slider* create(cocos2d::CCNode* target, cocos2d::SEL_MenuHandler click, float scale) {
|
||||
return create(target, click, "sliderBar.png", "slidergroove.png", "sliderthumb.png", "sliderthumbsel.png", scale);
|
||||
|
@ -5014,11 +5014,11 @@ class Slider : cocos2d::CCLayer {
|
|||
class SliderThumb : cocos2d::CCMenuItemImage {
|
||||
void setValue(float val) = mac 0x18ce80, win 0x2e1b0, ios 0x210db4;
|
||||
float getValue() {
|
||||
return (m_fScaleX * this->m_length * .5f +
|
||||
return (m_fScaleX * m_length * .5f +
|
||||
(m_vertical ?
|
||||
this->getPositionY() :
|
||||
this->getPositionX())
|
||||
) / (m_fScaleX * this->m_length);
|
||||
) / (m_fScaleX * m_length);
|
||||
}
|
||||
|
||||
float m_length;
|
||||
|
|
|
@ -17,7 +17,7 @@ protected:
|
|||
ErrorCallback m_error;
|
||||
bool m_filemode = false;
|
||||
|
||||
void* m_platform_handle;
|
||||
void* m_platformHandle;
|
||||
bool m_exiting = false;
|
||||
void watch();
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ std::vector<Hook*> Mod::Impl::getHooks() const {
|
|||
// Settings and saved values
|
||||
|
||||
Result<> Mod::Impl::loadData() {
|
||||
ModStateEvent(this->m_self, ModEventType::DataLoaded).post();
|
||||
ModStateEvent(m_self, ModEventType::DataLoaded).post();
|
||||
|
||||
// Settings
|
||||
// Check if settings exist
|
||||
|
@ -135,7 +135,7 @@ Result<> Mod::Impl::loadData() {
|
|||
if (!setting->load(value.json())) {
|
||||
log::internalLog(
|
||||
Severity::Error,
|
||||
this->m_self,
|
||||
m_self,
|
||||
"{}: Unable to load value for setting \"{}\"",
|
||||
m_info.id,
|
||||
key
|
||||
|
@ -145,7 +145,7 @@ Result<> Mod::Impl::loadData() {
|
|||
else {
|
||||
log::internalLog(
|
||||
Severity::Warning,
|
||||
this->m_self,
|
||||
m_self,
|
||||
"Encountered unknown setting \"{}\" while loading "
|
||||
"settings",
|
||||
key
|
||||
|
@ -174,7 +174,7 @@ Result<> Mod::Impl::loadData() {
|
|||
}
|
||||
|
||||
Result<> Mod::Impl::saveData() {
|
||||
ModStateEvent(this->m_self, ModEventType::DataSaved).post();
|
||||
ModStateEvent(m_self, ModEventType::DataSaved).post();
|
||||
|
||||
// Data saving should be fully fail-safe
|
||||
|
||||
|
@ -285,14 +285,14 @@ Result<> Mod::Impl::loadBinary() {
|
|||
return Err("Mod has unresolved dependencies");
|
||||
}
|
||||
|
||||
LoaderImpl::get()->provideNextMod(this->m_self);
|
||||
LoaderImpl::get()->provideNextMod(m_self);
|
||||
|
||||
GEODE_UNWRAP(this->loadPlatformBinary());
|
||||
m_binaryLoaded = true;
|
||||
|
||||
LoaderImpl::get()->releaseNextMod();
|
||||
|
||||
ModStateEvent(this->m_self, ModEventType::Loaded).post();
|
||||
ModStateEvent(m_self, ModEventType::Loaded).post();
|
||||
|
||||
Loader::get()->updateAllDependencies();
|
||||
|
||||
|
@ -313,7 +313,7 @@ Result<> Mod::Impl::unloadBinary() {
|
|||
GEODE_UNWRAP(this->saveData());
|
||||
|
||||
GEODE_UNWRAP(this->disable());
|
||||
ModStateEvent(this->m_self, ModEventType::Unloaded).post();
|
||||
ModStateEvent(m_self, ModEventType::Unloaded).post();
|
||||
|
||||
// Disabling unhooks and unpatches already
|
||||
for (auto const& hook : m_hooks) {
|
||||
|
@ -349,7 +349,7 @@ Result<> Mod::Impl::enable() {
|
|||
}
|
||||
}
|
||||
|
||||
ModStateEvent(this->m_self, ModEventType::Enabled).post();
|
||||
ModStateEvent(m_self, ModEventType::Enabled).post();
|
||||
m_enabled = true;
|
||||
|
||||
return Ok();
|
||||
|
@ -363,7 +363,7 @@ Result<> Mod::Impl::disable() {
|
|||
return Err("Mod does not support disabling");
|
||||
}
|
||||
|
||||
ModStateEvent(this->m_self, ModEventType::Disabled).post();
|
||||
ModStateEvent(m_self, ModEventType::Disabled).post();
|
||||
|
||||
for (auto const& hook : m_hooks) {
|
||||
GEODE_UNWRAP(this->disableHook(hook));
|
||||
|
@ -402,7 +402,7 @@ Result<> Mod::Impl::uninstall() {
|
|||
}
|
||||
|
||||
bool Mod::Impl::isUninstalled() const {
|
||||
return this->m_self != Mod::get() && !ghc::filesystem::exists(m_info.path);
|
||||
return m_self != Mod::get() && !ghc::filesystem::exists(m_info.path);
|
||||
}
|
||||
|
||||
// Dependencies
|
||||
|
@ -498,7 +498,7 @@ Result<Hook*> Mod::Impl::addHook(Hook* hook) {
|
|||
}
|
||||
}
|
||||
else {
|
||||
LoaderImpl::get()->addInternalHook(hook, this->m_self);
|
||||
LoaderImpl::get()->addInternalHook(hook, m_self);
|
||||
}
|
||||
|
||||
return Ok(hook);
|
||||
|
@ -528,7 +528,7 @@ Result<Patch*> Mod::Impl::patch(void* address, ByteVector const& data) {
|
|||
auto p = new Patch;
|
||||
p->m_address = address;
|
||||
p->m_original = readMemory(address, data.size());
|
||||
p->m_owner = this->m_self;
|
||||
p->m_owner = m_self;
|
||||
p->m_patch = data;
|
||||
if (!p->apply()) {
|
||||
delete p;
|
||||
|
|
|
@ -12,23 +12,23 @@
|
|||
FileWatcher::FileWatcher(
|
||||
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error
|
||||
) {
|
||||
this->m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
|
||||
this->m_platform_handle = NULL;
|
||||
this->m_file = file;
|
||||
this->m_callback = callback;
|
||||
this->m_error = error;
|
||||
m_platformHandle = NULL;
|
||||
m_file = file;
|
||||
m_callback = callback;
|
||||
m_error = error;
|
||||
this->watch();
|
||||
}
|
||||
|
||||
FileWatcher::~FileWatcher() {
|
||||
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(this->m_platform_handle));
|
||||
this->m_platform_handle = NULL;
|
||||
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(m_platformHandle));
|
||||
m_platformHandle = NULL;
|
||||
}
|
||||
|
||||
void FileWatcher::watch() {
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
int fildes = open(this->m_file.string().c_str(), O_EVTONLY);
|
||||
int fildes = open(m_file.string().c_str(), O_EVTONLY);
|
||||
|
||||
__block dispatch_source_t source = dispatch_source_create(
|
||||
DISPATCH_SOURCE_TYPE_VNODE, fildes,
|
||||
|
@ -38,11 +38,11 @@ void FileWatcher::watch() {
|
|||
queue
|
||||
);
|
||||
|
||||
this->m_platform_handle = static_cast<void*>(source);
|
||||
m_platformHandle = static_cast<void*>(source);
|
||||
|
||||
dispatch_source_set_event_handler(source, ^{
|
||||
if (this->m_callback) {
|
||||
this->m_callback(this->m_file);
|
||||
if (m_callback) {
|
||||
m_callback(m_file);
|
||||
}
|
||||
});
|
||||
dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); });
|
||||
|
@ -50,7 +50,7 @@ void FileWatcher::watch() {
|
|||
}
|
||||
|
||||
bool FileWatcher::watching() const {
|
||||
return this->m_platform_handle != NULL;
|
||||
return m_platformHandle != NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,12 +19,12 @@ T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) {
|
|||
|
||||
Result<> Mod::Impl::loadPlatformBinary() {
|
||||
auto dylib =
|
||||
dlopen((this->m_tempDirName / this->m_info.binaryName).string().c_str(), RTLD_LAZY);
|
||||
dlopen((m_tempDirName / m_info.binaryName).string().c_str(), RTLD_LAZY);
|
||||
if (dylib) {
|
||||
if (this->m_platformInfo) {
|
||||
delete this->m_platformInfo;
|
||||
if (m_platformInfo) {
|
||||
delete m_platformInfo;
|
||||
}
|
||||
this->m_platformInfo = new PlatformInfo { dylib };
|
||||
m_platformInfo = new PlatformInfo { dylib };
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ Result<> Mod::Impl::loadPlatformBinary() {
|
|||
}
|
||||
|
||||
Result<> Mod::Impl::unloadPlatformBinary() {
|
||||
auto dylib = this->m_platformInfo->m_dylib;
|
||||
delete this->m_platformInfo;
|
||||
this->m_platformInfo = nullptr;
|
||||
auto dylib = m_platformInfo->m_dylib;
|
||||
delete m_platformInfo;
|
||||
m_platformInfo = nullptr;
|
||||
if (dlclose(dylib) == 0) {
|
||||
return Ok();
|
||||
}
|
||||
|
|
|
@ -12,23 +12,23 @@
|
|||
FileWatcher::FileWatcher(
|
||||
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error
|
||||
) {
|
||||
this->m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
|
||||
this->m_platform_handle = NULL;
|
||||
this->m_file = file;
|
||||
this->m_callback = callback;
|
||||
this->m_error = error;
|
||||
m_platformHandle = NULL;
|
||||
m_file = file;
|
||||
m_callback = callback;
|
||||
m_error = error;
|
||||
this->watch();
|
||||
}
|
||||
|
||||
FileWatcher::~FileWatcher() {
|
||||
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(this->m_platform_handle));
|
||||
this->m_platform_handle = NULL;
|
||||
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(m_platformHandle));
|
||||
m_platformHandle = NULL;
|
||||
}
|
||||
|
||||
void FileWatcher::watch() {
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
int fildes = open(this->m_file.string().c_str(), O_EVTONLY);
|
||||
int fildes = open(m_file.string().c_str(), O_EVTONLY);
|
||||
|
||||
__block dispatch_source_t source = dispatch_source_create(
|
||||
DISPATCH_SOURCE_TYPE_VNODE, fildes,
|
||||
|
@ -38,11 +38,11 @@ void FileWatcher::watch() {
|
|||
queue
|
||||
);
|
||||
|
||||
this->m_platform_handle = static_cast<void*>(source);
|
||||
m_platformHandle = static_cast<void*>(source);
|
||||
|
||||
dispatch_source_set_event_handler(source, ^{
|
||||
if (this->m_callback) {
|
||||
this->m_callback(this->m_file);
|
||||
if (m_callback) {
|
||||
m_callback(m_file);
|
||||
}
|
||||
});
|
||||
dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); });
|
||||
|
@ -50,7 +50,7 @@ void FileWatcher::watch() {
|
|||
}
|
||||
|
||||
bool FileWatcher::watching() const {
|
||||
return this->m_platform_handle != NULL;
|
||||
return m_platformHandle != NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,12 +19,12 @@ T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) {
|
|||
|
||||
Result<> Mod::Impl::loadPlatformBinary() {
|
||||
auto dylib =
|
||||
dlopen((this->m_tempDirName / this->m_info.binaryName).string().c_str(), RTLD_LAZY);
|
||||
dlopen((m_tempDirName / m_info.binaryName).string().c_str(), RTLD_LAZY);
|
||||
if (dylib) {
|
||||
if (this->m_platformInfo) {
|
||||
delete this->m_platformInfo;
|
||||
if (m_platformInfo) {
|
||||
delete m_platformInfo;
|
||||
}
|
||||
this->m_platformInfo = new PlatformInfo { dylib };
|
||||
m_platformInfo = new PlatformInfo { dylib };
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ Result<> Mod::Impl::loadPlatformBinary() {
|
|||
}
|
||||
|
||||
Result<> Mod::Impl::unloadPlatformBinary() {
|
||||
auto dylib = this->m_platformInfo->m_dylib;
|
||||
delete this->m_platformInfo;
|
||||
this->m_platformInfo = nullptr;
|
||||
auto dylib = m_platformInfo->m_dylib;
|
||||
delete m_platformInfo;
|
||||
m_platformInfo = nullptr;
|
||||
if (dlclose(dylib) == 0) {
|
||||
return Ok();
|
||||
}
|
||||
|
|
|
@ -10,43 +10,43 @@ static constexpr auto const notifyAttributes =
|
|||
FileWatcher::FileWatcher(
|
||||
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error
|
||||
) {
|
||||
this->m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
m_filemode = ghc::filesystem::is_regular_file(file);
|
||||
auto handle = FindFirstChangeNotificationW(
|
||||
(this->m_filemode ? file.parent_path() : file).wstring().c_str(), false, notifyAttributes
|
||||
(m_filemode ? file.parent_path() : file).wstring().c_str(), false, notifyAttributes
|
||||
);
|
||||
this->m_platform_handle = (void*)handle;
|
||||
m_platformHandle = (void*)handle;
|
||||
|
||||
this->m_file = file;
|
||||
this->m_callback = callback;
|
||||
this->m_error = error;
|
||||
m_file = file;
|
||||
m_callback = callback;
|
||||
m_error = error;
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
std::thread(&FileWatcher::watch, this).detach();
|
||||
}
|
||||
else {
|
||||
if (this->m_error) this->m_error("Invalid handle");
|
||||
if (m_error) m_error("Invalid handle");
|
||||
}
|
||||
}
|
||||
|
||||
FileWatcher::~FileWatcher() {
|
||||
HANDLE handle = (HANDLE)this->m_platform_handle;
|
||||
HANDLE handle = (HANDLE)m_platformHandle;
|
||||
FindCloseChangeNotification(handle);
|
||||
this->m_exiting = true;
|
||||
m_exiting = true;
|
||||
}
|
||||
|
||||
void FileWatcher::watch() {
|
||||
HANDLE handle = (HANDLE)this->m_platform_handle;
|
||||
HANDLE handle = (HANDLE)m_platformHandle;
|
||||
while (WaitForSingleObject(handle, 10000) == WAIT_OBJECT_0) {
|
||||
if (this->m_exiting) return;
|
||||
if (this->m_callback) {
|
||||
if (this->m_filemode) {
|
||||
if (m_exiting) return;
|
||||
if (m_callback) {
|
||||
if (m_filemode) {
|
||||
auto file = CreateFileW(
|
||||
this->m_file.parent_path().wstring().c_str(), FILE_LIST_DIRECTORY,
|
||||
m_file.parent_path().wstring().c_str(), FILE_LIST_DIRECTORY,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, nullptr
|
||||
);
|
||||
if (file == INVALID_HANDLE_VALUE) {
|
||||
handle = nullptr;
|
||||
if (this->m_error) this->m_error("Reading dir failed");
|
||||
if (m_error) m_error("Reading dir failed");
|
||||
return;
|
||||
}
|
||||
OVERLAPPED overlapped;
|
||||
|
@ -58,13 +58,13 @@ void FileWatcher::watch() {
|
|||
&overlapped, nullptr
|
||||
)) {
|
||||
handle = nullptr;
|
||||
if (this->m_error) this->m_error("Reading dir changes failed");
|
||||
if (m_error) m_error("Reading dir changes failed");
|
||||
return;
|
||||
}
|
||||
DWORD result = WaitForSingleObject(overlapped.hEvent, 500);
|
||||
if (result != WAIT_OBJECT_0 && result != WAIT_TIMEOUT) {
|
||||
handle = nullptr;
|
||||
if (this->m_error) this->m_error("Overlap hEvent was not WAIT_OBJECT_0");
|
||||
if (m_error) m_error("Overlap hEvent was not WAIT_OBJECT_0");
|
||||
return;
|
||||
}
|
||||
DWORD bytes_transferred;
|
||||
|
@ -74,30 +74,30 @@ void FileWatcher::watch() {
|
|||
auto filename = std::wstring(
|
||||
info->FileName, info->FileName + info->FileNameLength / sizeof(wchar_t)
|
||||
);
|
||||
if (ghc::filesystem::exists(this->m_file) &&
|
||||
ghc::filesystem::file_size(this->m_file) > 1000 &&
|
||||
if (ghc::filesystem::exists(m_file) &&
|
||||
ghc::filesystem::file_size(m_file) > 1000 &&
|
||||
info->Action == FILE_ACTION_MODIFIED &&
|
||||
this->m_file.filename().wstring() == filename) {
|
||||
this->m_callback(this->m_file);
|
||||
m_file.filename().wstring() == filename) {
|
||||
m_callback(m_file);
|
||||
}
|
||||
} while (info->NextEntryOffset && (info = info + info->NextEntryOffset));
|
||||
}
|
||||
else {
|
||||
this->m_callback(this->m_file);
|
||||
m_callback(m_file);
|
||||
}
|
||||
}
|
||||
if (!FindNextChangeNotification(handle)) {
|
||||
handle = nullptr;
|
||||
if (this->m_error) this->m_error("FindNextChangeNotification failed");
|
||||
if (m_error) m_error("FindNextChangeNotification failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
handle = nullptr;
|
||||
if (this->m_error) this->m_error("WaitForSingleObject failed");
|
||||
if (m_error) m_error("WaitForSingleObject failed");
|
||||
}
|
||||
|
||||
bool FileWatcher::watching() const {
|
||||
HANDLE handle = (HANDLE)this->m_platform_handle;
|
||||
HANDLE handle = (HANDLE)m_platformHandle;
|
||||
return handle != INVALID_HANDLE_VALUE && handle != nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ bool HookListLayer::init(Mod* mod) {
|
|||
for (auto const& hook : mod->getHooks()) {
|
||||
hooks->addObject(new HookItem(hook));
|
||||
}
|
||||
this->m_listLayer->m_listView = HookListView::create(hooks, mod, 356.f, 220.f);
|
||||
this->m_listLayer->addChild(this->m_listLayer->m_listView);
|
||||
m_listLayer->m_listView = HookListView::create(hooks, mod, 356.f, 220.f);
|
||||
m_listLayer->addChild(m_listLayer->m_listView);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void ListView::setupList() {
|
|||
}
|
||||
|
||||
TableViewCell* ListView::getListCell(char const* key) {
|
||||
return GenericListCell::create(key, { this->m_width, this->m_itemSeparation });
|
||||
return GenericListCell::create(key, { m_width, m_itemSeparation });
|
||||
}
|
||||
|
||||
void ListView::loadCell(TableViewCell* cell, unsigned int index) {
|
||||
|
|
|
@ -689,12 +689,12 @@ CCScrollLayerExt* MDTextArea::getScrollLayer() const {
|
|||
}
|
||||
|
||||
void MDTextArea::setString(char const* text) {
|
||||
this->m_text = text;
|
||||
m_text = text;
|
||||
this->updateLabel();
|
||||
}
|
||||
|
||||
char const* MDTextArea::getString() {
|
||||
return this->m_text.c_str();
|
||||
return m_text.c_str();
|
||||
}
|
||||
|
||||
MDTextArea* MDTextArea::create(std::string const& str, CCSize const& size) {
|
||||
|
|
|
@ -292,7 +292,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
|
|||
Loader::get()->queueInGDThread([this, ret]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
for (auto& then : m_thens) {
|
||||
then(*this->m_self, ret);
|
||||
then(*m_self, ret);
|
||||
}
|
||||
std::lock_guard __(RUNNING_REQUESTS_MUTEX);
|
||||
RUNNING_REQUESTS.erase(m_id);
|
||||
|
@ -319,7 +319,7 @@ void SentAsyncWebRequest::Impl::doCancel() {
|
|||
Loader::get()->queueInGDThread([this]() {
|
||||
std::lock_guard _(m_mutex);
|
||||
for (auto& canc : m_cancelleds) {
|
||||
canc(*this->m_self);
|
||||
canc(*m_self);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue