remove cursed this->m_

This commit is contained in:
altalk23 2022-12-31 18:20:43 +03:00
parent eb3b84113c
commit 07e64c4dc9
12 changed files with 123 additions and 123 deletions

View file

@ -326,18 +326,18 @@ class CCLightFlash {
class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite { class CCMenuItemSpriteExtra : cocos2d::CCMenuItemSprite {
void useAnimationType(MenuAnimationType type) { void useAnimationType(MenuAnimationType type) {
this->m_startPosition = this->getNormalImage()->getPosition(); m_startPosition = this->getNormalImage()->getPosition();
this->m_animationType = type; m_animationType = type;
} }
void setDestination(cocos2d::CCPoint const& pos) { void setDestination(cocos2d::CCPoint const& pos) {
this->m_destPosition = pos; m_destPosition = pos;
} }
void setOffset(cocos2d::CCPoint const& pos) { void setOffset(cocos2d::CCPoint const& pos) {
this->m_offset = pos; m_offset = pos;
} }
void setScale(float scale) { void setScale(float scale) {
this->CCMenuItemSprite::setScale(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; 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() { float getMinY() {
return this->getContentSize().height - return this->getContentSize().height -
this->m_contentLayer->getContentSize().height - m_contentLayer->getContentSize().height -
this->m_scrollLimitTop; m_scrollLimitTop;
} }
float getMaxY() { float getMaxY() {
return this->m_scrollLimitBottom; return m_scrollLimitBottom;
} }
// todo: add this back when CCDestructor works and // todo: add this back when CCDestructor works and
@ -1048,12 +1048,12 @@ class DrawGridLayer : cocos2d::CCLayer {
class EditButtonBar : cocos2d::CCNode { class EditButtonBar : cocos2d::CCNode {
void removeAllItems() { void removeAllItems() {
this->m_buttonArray->removeAllObjects(); m_buttonArray->removeAllObjects();
this->reloadItemsInNormalSize(); this->reloadItemsInNormalSize();
} }
void reloadItems(int rowCount, int columnCount) { void reloadItems(int rowCount, int columnCount) {
if (this->m_buttonArray) if (m_buttonArray)
this->loadFromItems(this->m_buttonArray, rowCount, columnCount, this->m_unknown); this->loadFromItems(m_buttonArray, rowCount, columnCount, m_unknown);
} }
void reloadItemsInNormalSize() { void reloadItemsInNormalSize() {
// TODO: fix this // TODO: fix this
@ -1063,8 +1063,8 @@ class EditButtonBar : cocos2d::CCNode {
// ); // );
} }
void addButton(CCMenuItemSpriteExtra* btn, bool reload) { void addButton(CCMenuItemSpriteExtra* btn, bool reload) {
if (this->m_buttonArray) if (m_buttonArray)
this->m_buttonArray->addObject(btn); m_buttonArray->addObject(btn);
if (reload) if (reload)
this->reloadItemsInNormalSize(); this->reloadItemsInNormalSize();
} }
@ -1361,19 +1361,19 @@ class EffectGameObject : GameObject {
void updateLabel() { void updateLabel() {
auto label = static_cast<cocos2d::CCLabelBMFont*>(this->getChildByTag(999)); auto label = static_cast<cocos2d::CCLabelBMFont*>(this->getChildByTag(999));
if (label) { if (label) {
switch (this->m_objectID) { switch (m_objectID) {
// instant count, collision block, pickup // instant count, collision block, pickup
case 0x713: [[fallthrough]]; case 0x713: [[fallthrough]];
case 0x718: [[fallthrough]]; case 0x718: [[fallthrough]];
case 0x716: case 0x716:
label->setString( label->setString(
cocos2d::CCString::createWithFormat("%i", this->m_itemBlockAID)->getCString() cocos2d::CCString::createWithFormat("%i", m_itemBlockAID)->getCString()
); );
break; break;
// color, pulse // color, pulse
case 899: [[fallthrough]]; case 899: [[fallthrough]];
case 1006: { case 1006: {
int target = this->m_objectID == 1006 ? m_targetGroupID : m_targetColorID; int target = m_objectID == 1006 ? m_targetGroupID : m_targetColorID;
if (target > 999) { if (target > 999) {
label->setString(GJSpecialColorSelect::textForColorIdx(target)); label->setString(GJSpecialColorSelect::textForColorIdx(target));
} else { } else {
@ -1385,7 +1385,7 @@ class EffectGameObject : GameObject {
} break; } break;
default: default:
label->setString( 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; return m_objectLayer;
} }
cocos2d::CCArray* getAllObjects() { cocos2d::CCArray* getAllObjects() {
return this->m_objects; return m_objects;
} }
static GJBaseGameLayer* get() { static GJBaseGameLayer* get() {
@ -2353,10 +2353,10 @@ class GJRobotSprite : CCAnimatedSprite {
class GJRotationControl : cocos2d::CCLayer { class GJRotationControl : cocos2d::CCLayer {
void setAngle(float angle) { void setAngle(float angle) {
this->m_sliderPosition = cocos2d::CCPointMake(sinf(angle) * 60.0f, cosf(angle) * 60.0f); m_sliderPosition = cocos2d::CCPointMake(sinf(angle) * 60.0f, cosf(angle) * 60.0f);
this->m_angle = angle; m_angle = angle;
this->m_sliderThumb->setPosition(this->m_sliderPosition); m_sliderThumb->setPosition(m_sliderPosition);
} }
void updateSliderPosition(cocos2d::CCPoint const& pos) = win 0x94020; void updateSliderPosition(cocos2d::CCPoint const& pos) = win 0x94020;
@ -2408,7 +2408,7 @@ class GJScoreCell : TableViewCell {
class GJSearchObject : cocos2d::CCNode { class GJSearchObject : cocos2d::CCNode {
SearchType getType() { SearchType getType() {
return this->m_searchType; return m_searchType;
} }
static GJSearchObject* create(SearchType nID) = win 0xc2b90; static GJSearchObject* create(SearchType nID) = win 0xc2b90;
@ -2468,46 +2468,46 @@ class GJUserCell : TableViewCell {
class GJUserScore : cocos2d::CCNode { class GJUserScore : cocos2d::CCNode {
IconType getIconType() const { IconType getIconType() const {
return this->m_iconType; return m_iconType;
} }
int getPlayerCube() const { int getPlayerCube() const {
return this->m_playerCube; return m_playerCube;
} }
int getPlayerShip() const { int getPlayerShip() const {
return this->m_playerShip; return m_playerShip;
} }
int getPlayerBall() const { int getPlayerBall() const {
return this->m_playerBall; return m_playerBall;
} }
int getPlayerUfo() const { int getPlayerUfo() const {
return this->m_playerUfo; return m_playerUfo;
} }
int getPlayerWave() const { int getPlayerWave() const {
return this->m_playerWave; return m_playerWave;
} }
int getPlayerRobot() const { int getPlayerRobot() const {
return this->m_playerRobot; return m_playerRobot;
} }
int getPlayerSpider() const { int getPlayerSpider() const {
return this->m_playerSpider; return m_playerSpider;
} }
int getPlayerStreak() const { int getPlayerStreak() const {
return this->m_playerStreak; return m_playerStreak;
} }
bool getGlowEnabled() const { bool getGlowEnabled() const {
return this->m_glowEnabled; return m_glowEnabled;
} }
int getPlayerExplosion() const { int getPlayerExplosion() const {
return this->m_playerExplosion; return m_playerExplosion;
} }
int getPlayerColor1() const { int getPlayerColor1() const {
return this->m_color1; return m_color1;
} }
int getPlayerColor2() const { int getPlayerColor2() const {
return this->m_color2; return m_color2;
} }
gd::string getPlayerName() const { gd::string getPlayerName() const {
return this->m_userName; return m_userName;
} }
static GJUserScore* create() = win 0xc1660; static GJUserScore* create() = win 0xc1660;
static GJUserScore* create(cocos2d::CCDictionary*) = win 0xc0750; static GJUserScore* create(cocos2d::CCDictionary*) = win 0xc0750;
@ -4991,10 +4991,10 @@ class SimplePlayer : cocos2d::CCSprite {
class Slider : cocos2d::CCLayer { class Slider : cocos2d::CCLayer {
void setValue(float val) { void setValue(float val) {
this->m_touchLogic->getThumb()->setValue(val); m_touchLogic->getThumb()->setValue(val);
} }
void setBarVisibility(bool v) { 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) { 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); 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 { class SliderThumb : cocos2d::CCMenuItemImage {
void setValue(float val) = mac 0x18ce80, win 0x2e1b0, ios 0x210db4; void setValue(float val) = mac 0x18ce80, win 0x2e1b0, ios 0x210db4;
float getValue() { float getValue() {
return (m_fScaleX * this->m_length * .5f + return (m_fScaleX * m_length * .5f +
(m_vertical ? (m_vertical ?
this->getPositionY() : this->getPositionY() :
this->getPositionX()) this->getPositionX())
) / (m_fScaleX * this->m_length); ) / (m_fScaleX * m_length);
} }
float m_length; float m_length;

View file

@ -17,7 +17,7 @@ protected:
ErrorCallback m_error; ErrorCallback m_error;
bool m_filemode = false; bool m_filemode = false;
void* m_platform_handle; void* m_platformHandle;
bool m_exiting = false; bool m_exiting = false;
void watch(); void watch();

View file

@ -113,7 +113,7 @@ std::vector<Hook*> Mod::Impl::getHooks() const {
// Settings and saved values // Settings and saved values
Result<> Mod::Impl::loadData() { Result<> Mod::Impl::loadData() {
ModStateEvent(this->m_self, ModEventType::DataLoaded).post(); ModStateEvent(m_self, ModEventType::DataLoaded).post();
// Settings // Settings
// Check if settings exist // Check if settings exist
@ -135,7 +135,7 @@ Result<> Mod::Impl::loadData() {
if (!setting->load(value.json())) { if (!setting->load(value.json())) {
log::internalLog( log::internalLog(
Severity::Error, Severity::Error,
this->m_self, m_self,
"{}: Unable to load value for setting \"{}\"", "{}: Unable to load value for setting \"{}\"",
m_info.id, m_info.id,
key key
@ -145,7 +145,7 @@ Result<> Mod::Impl::loadData() {
else { else {
log::internalLog( log::internalLog(
Severity::Warning, Severity::Warning,
this->m_self, m_self,
"Encountered unknown setting \"{}\" while loading " "Encountered unknown setting \"{}\" while loading "
"settings", "settings",
key key
@ -174,7 +174,7 @@ Result<> Mod::Impl::loadData() {
} }
Result<> Mod::Impl::saveData() { Result<> Mod::Impl::saveData() {
ModStateEvent(this->m_self, ModEventType::DataSaved).post(); ModStateEvent(m_self, ModEventType::DataSaved).post();
// Data saving should be fully fail-safe // Data saving should be fully fail-safe
@ -285,14 +285,14 @@ Result<> Mod::Impl::loadBinary() {
return Err("Mod has unresolved dependencies"); return Err("Mod has unresolved dependencies");
} }
LoaderImpl::get()->provideNextMod(this->m_self); LoaderImpl::get()->provideNextMod(m_self);
GEODE_UNWRAP(this->loadPlatformBinary()); GEODE_UNWRAP(this->loadPlatformBinary());
m_binaryLoaded = true; m_binaryLoaded = true;
LoaderImpl::get()->releaseNextMod(); LoaderImpl::get()->releaseNextMod();
ModStateEvent(this->m_self, ModEventType::Loaded).post(); ModStateEvent(m_self, ModEventType::Loaded).post();
Loader::get()->updateAllDependencies(); Loader::get()->updateAllDependencies();
@ -313,7 +313,7 @@ Result<> Mod::Impl::unloadBinary() {
GEODE_UNWRAP(this->saveData()); GEODE_UNWRAP(this->saveData());
GEODE_UNWRAP(this->disable()); GEODE_UNWRAP(this->disable());
ModStateEvent(this->m_self, ModEventType::Unloaded).post(); ModStateEvent(m_self, ModEventType::Unloaded).post();
// Disabling unhooks and unpatches already // Disabling unhooks and unpatches already
for (auto const& hook : m_hooks) { 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; m_enabled = true;
return Ok(); return Ok();
@ -363,7 +363,7 @@ Result<> Mod::Impl::disable() {
return Err("Mod does not support disabling"); 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) { for (auto const& hook : m_hooks) {
GEODE_UNWRAP(this->disableHook(hook)); GEODE_UNWRAP(this->disableHook(hook));
@ -402,7 +402,7 @@ Result<> Mod::Impl::uninstall() {
} }
bool Mod::Impl::isUninstalled() const { 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 // Dependencies
@ -498,7 +498,7 @@ Result<Hook*> Mod::Impl::addHook(Hook* hook) {
} }
} }
else { else {
LoaderImpl::get()->addInternalHook(hook, this->m_self); LoaderImpl::get()->addInternalHook(hook, m_self);
} }
return Ok(hook); return Ok(hook);
@ -528,7 +528,7 @@ Result<Patch*> Mod::Impl::patch(void* address, ByteVector const& data) {
auto p = new Patch; auto p = new Patch;
p->m_address = address; p->m_address = address;
p->m_original = readMemory(address, data.size()); p->m_original = readMemory(address, data.size());
p->m_owner = this->m_self; p->m_owner = m_self;
p->m_patch = data; p->m_patch = data;
if (!p->apply()) { if (!p->apply()) {
delete p; delete p;

View file

@ -12,23 +12,23 @@
FileWatcher::FileWatcher( FileWatcher::FileWatcher(
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error 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; m_platformHandle = NULL;
this->m_file = file; m_file = file;
this->m_callback = callback; m_callback = callback;
this->m_error = error; m_error = error;
this->watch(); this->watch();
} }
FileWatcher::~FileWatcher() { FileWatcher::~FileWatcher() {
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(this->m_platform_handle)); dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(m_platformHandle));
this->m_platform_handle = NULL; m_platformHandle = NULL;
} }
void FileWatcher::watch() { void FileWatcher::watch() {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 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( __block dispatch_source_t source = dispatch_source_create(
DISPATCH_SOURCE_TYPE_VNODE, fildes, DISPATCH_SOURCE_TYPE_VNODE, fildes,
@ -38,11 +38,11 @@ void FileWatcher::watch() {
queue queue
); );
this->m_platform_handle = static_cast<void*>(source); m_platformHandle = static_cast<void*>(source);
dispatch_source_set_event_handler(source, ^{ dispatch_source_set_event_handler(source, ^{
if (this->m_callback) { if (m_callback) {
this->m_callback(this->m_file); m_callback(m_file);
} }
}); });
dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); }); dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); });
@ -50,7 +50,7 @@ void FileWatcher::watch() {
} }
bool FileWatcher::watching() const { bool FileWatcher::watching() const {
return this->m_platform_handle != NULL; return m_platformHandle != NULL;
} }
#endif #endif

View file

@ -19,12 +19,12 @@ T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) {
Result<> Mod::Impl::loadPlatformBinary() { Result<> Mod::Impl::loadPlatformBinary() {
auto dylib = 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 (dylib) {
if (this->m_platformInfo) { if (m_platformInfo) {
delete this->m_platformInfo; delete m_platformInfo;
} }
this->m_platformInfo = new PlatformInfo { dylib }; m_platformInfo = new PlatformInfo { dylib };
return Ok(); return Ok();
} }
@ -33,9 +33,9 @@ Result<> Mod::Impl::loadPlatformBinary() {
} }
Result<> Mod::Impl::unloadPlatformBinary() { Result<> Mod::Impl::unloadPlatformBinary() {
auto dylib = this->m_platformInfo->m_dylib; auto dylib = m_platformInfo->m_dylib;
delete this->m_platformInfo; delete m_platformInfo;
this->m_platformInfo = nullptr; m_platformInfo = nullptr;
if (dlclose(dylib) == 0) { if (dlclose(dylib) == 0) {
return Ok(); return Ok();
} }

View file

@ -12,23 +12,23 @@
FileWatcher::FileWatcher( FileWatcher::FileWatcher(
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error 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; m_platformHandle = NULL;
this->m_file = file; m_file = file;
this->m_callback = callback; m_callback = callback;
this->m_error = error; m_error = error;
this->watch(); this->watch();
} }
FileWatcher::~FileWatcher() { FileWatcher::~FileWatcher() {
dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(this->m_platform_handle)); dispatch_source_cancel(reinterpret_cast<dispatch_source_t>(m_platformHandle));
this->m_platform_handle = NULL; m_platformHandle = NULL;
} }
void FileWatcher::watch() { void FileWatcher::watch() {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 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( __block dispatch_source_t source = dispatch_source_create(
DISPATCH_SOURCE_TYPE_VNODE, fildes, DISPATCH_SOURCE_TYPE_VNODE, fildes,
@ -38,11 +38,11 @@ void FileWatcher::watch() {
queue queue
); );
this->m_platform_handle = static_cast<void*>(source); m_platformHandle = static_cast<void*>(source);
dispatch_source_set_event_handler(source, ^{ dispatch_source_set_event_handler(source, ^{
if (this->m_callback) { if (m_callback) {
this->m_callback(this->m_file); m_callback(m_file);
} }
}); });
dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); }); dispatch_source_set_cancel_handler(source, ^(void) { close(fildes); });
@ -50,7 +50,7 @@ void FileWatcher::watch() {
} }
bool FileWatcher::watching() const { bool FileWatcher::watching() const {
return this->m_platform_handle != NULL; return m_platformHandle != NULL;
} }
#endif #endif

View file

@ -19,12 +19,12 @@ T findSymbolOrMangled(void* dylib, char const* name, char const* mangled) {
Result<> Mod::Impl::loadPlatformBinary() { Result<> Mod::Impl::loadPlatformBinary() {
auto dylib = 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 (dylib) {
if (this->m_platformInfo) { if (m_platformInfo) {
delete this->m_platformInfo; delete m_platformInfo;
} }
this->m_platformInfo = new PlatformInfo { dylib }; m_platformInfo = new PlatformInfo { dylib };
return Ok(); return Ok();
} }
@ -33,9 +33,9 @@ Result<> Mod::Impl::loadPlatformBinary() {
} }
Result<> Mod::Impl::unloadPlatformBinary() { Result<> Mod::Impl::unloadPlatformBinary() {
auto dylib = this->m_platformInfo->m_dylib; auto dylib = m_platformInfo->m_dylib;
delete this->m_platformInfo; delete m_platformInfo;
this->m_platformInfo = nullptr; m_platformInfo = nullptr;
if (dlclose(dylib) == 0) { if (dlclose(dylib) == 0) {
return Ok(); return Ok();
} }

View file

@ -10,43 +10,43 @@ static constexpr auto const notifyAttributes =
FileWatcher::FileWatcher( FileWatcher::FileWatcher(
ghc::filesystem::path const& file, FileWatchCallback callback, ErrorCallback error 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( 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; m_file = file;
this->m_callback = callback; m_callback = callback;
this->m_error = error; m_error = error;
if (handle != INVALID_HANDLE_VALUE) { if (handle != INVALID_HANDLE_VALUE) {
std::thread(&FileWatcher::watch, this).detach(); std::thread(&FileWatcher::watch, this).detach();
} }
else { else {
if (this->m_error) this->m_error("Invalid handle"); if (m_error) m_error("Invalid handle");
} }
} }
FileWatcher::~FileWatcher() { FileWatcher::~FileWatcher() {
HANDLE handle = (HANDLE)this->m_platform_handle; HANDLE handle = (HANDLE)m_platformHandle;
FindCloseChangeNotification(handle); FindCloseChangeNotification(handle);
this->m_exiting = true; m_exiting = true;
} }
void FileWatcher::watch() { void FileWatcher::watch() {
HANDLE handle = (HANDLE)this->m_platform_handle; HANDLE handle = (HANDLE)m_platformHandle;
while (WaitForSingleObject(handle, 10000) == WAIT_OBJECT_0) { while (WaitForSingleObject(handle, 10000) == WAIT_OBJECT_0) {
if (this->m_exiting) return; if (m_exiting) return;
if (this->m_callback) { if (m_callback) {
if (this->m_filemode) { if (m_filemode) {
auto file = CreateFileW( 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_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, nullptr FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, nullptr
); );
if (file == INVALID_HANDLE_VALUE) { if (file == INVALID_HANDLE_VALUE) {
handle = nullptr; handle = nullptr;
if (this->m_error) this->m_error("Reading dir failed"); if (m_error) m_error("Reading dir failed");
return; return;
} }
OVERLAPPED overlapped; OVERLAPPED overlapped;
@ -58,13 +58,13 @@ void FileWatcher::watch() {
&overlapped, nullptr &overlapped, nullptr
)) { )) {
handle = nullptr; handle = nullptr;
if (this->m_error) this->m_error("Reading dir changes failed"); if (m_error) m_error("Reading dir changes failed");
return; return;
} }
DWORD result = WaitForSingleObject(overlapped.hEvent, 500); DWORD result = WaitForSingleObject(overlapped.hEvent, 500);
if (result != WAIT_OBJECT_0 && result != WAIT_TIMEOUT) { if (result != WAIT_OBJECT_0 && result != WAIT_TIMEOUT) {
handle = nullptr; 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; return;
} }
DWORD bytes_transferred; DWORD bytes_transferred;
@ -74,30 +74,30 @@ void FileWatcher::watch() {
auto filename = std::wstring( auto filename = std::wstring(
info->FileName, info->FileName + info->FileNameLength / sizeof(wchar_t) info->FileName, info->FileName + info->FileNameLength / sizeof(wchar_t)
); );
if (ghc::filesystem::exists(this->m_file) && if (ghc::filesystem::exists(m_file) &&
ghc::filesystem::file_size(this->m_file) > 1000 && ghc::filesystem::file_size(m_file) > 1000 &&
info->Action == FILE_ACTION_MODIFIED && info->Action == FILE_ACTION_MODIFIED &&
this->m_file.filename().wstring() == filename) { m_file.filename().wstring() == filename) {
this->m_callback(this->m_file); m_callback(m_file);
} }
} while (info->NextEntryOffset && (info = info + info->NextEntryOffset)); } while (info->NextEntryOffset && (info = info + info->NextEntryOffset));
} }
else { else {
this->m_callback(this->m_file); m_callback(m_file);
} }
} }
if (!FindNextChangeNotification(handle)) { if (!FindNextChangeNotification(handle)) {
handle = nullptr; handle = nullptr;
if (this->m_error) this->m_error("FindNextChangeNotification failed"); if (m_error) m_error("FindNextChangeNotification failed");
return; return;
} }
} }
handle = nullptr; handle = nullptr;
if (this->m_error) this->m_error("WaitForSingleObject failed"); if (m_error) m_error("WaitForSingleObject failed");
} }
bool FileWatcher::watching() const { bool FileWatcher::watching() const {
HANDLE handle = (HANDLE)this->m_platform_handle; HANDLE handle = (HANDLE)m_platformHandle;
return handle != INVALID_HANDLE_VALUE && handle != nullptr; return handle != INVALID_HANDLE_VALUE && handle != nullptr;
} }

View file

@ -10,8 +10,8 @@ bool HookListLayer::init(Mod* mod) {
for (auto const& hook : mod->getHooks()) { for (auto const& hook : mod->getHooks()) {
hooks->addObject(new HookItem(hook)); hooks->addObject(new HookItem(hook));
} }
this->m_listLayer->m_listView = HookListView::create(hooks, mod, 356.f, 220.f); m_listLayer->m_listView = HookListView::create(hooks, mod, 356.f, 220.f);
this->m_listLayer->addChild(this->m_listLayer->m_listView); m_listLayer->addChild(m_listLayer->m_listView);
return true; return true;
} }

View file

@ -49,7 +49,7 @@ void ListView::setupList() {
} }
TableViewCell* ListView::getListCell(char const* key) { 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) { void ListView::loadCell(TableViewCell* cell, unsigned int index) {

View file

@ -689,12 +689,12 @@ CCScrollLayerExt* MDTextArea::getScrollLayer() const {
} }
void MDTextArea::setString(char const* text) { void MDTextArea::setString(char const* text) {
this->m_text = text; m_text = text;
this->updateLabel(); this->updateLabel();
} }
char const* MDTextArea::getString() { 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) { MDTextArea* MDTextArea::create(std::string const& str, CCSize const& size) {

View file

@ -292,7 +292,7 @@ SentAsyncWebRequest::Impl::Impl(SentAsyncWebRequest* self, AsyncWebRequest const
Loader::get()->queueInGDThread([this, ret]() { Loader::get()->queueInGDThread([this, ret]() {
std::lock_guard _(m_mutex); std::lock_guard _(m_mutex);
for (auto& then : m_thens) { for (auto& then : m_thens) {
then(*this->m_self, ret); then(*m_self, ret);
} }
std::lock_guard __(RUNNING_REQUESTS_MUTEX); std::lock_guard __(RUNNING_REQUESTS_MUTEX);
RUNNING_REQUESTS.erase(m_id); RUNNING_REQUESTS.erase(m_id);
@ -319,7 +319,7 @@ void SentAsyncWebRequest::Impl::doCancel() {
Loader::get()->queueInGDThread([this]() { Loader::get()->queueInGDThread([this]() {
std::lock_guard _(m_mutex); std::lock_guard _(m_mutex);
for (auto& canc : m_cancelleds) { for (auto& canc : m_cancelleds) {
canc(*this->m_self); canc(*m_self);
} }
}); });