Fix subtitle alignment

This commit is contained in:
Neo 2023-03-26 02:51:49 +01:00
parent 2f0380d8f0
commit b63f89c89d
2 changed files with 15 additions and 8 deletions

View File

@ -7,6 +7,6 @@
/**************************
* Magia Translate Ver *
**************************/
#define MT_VERSION 118
#define MT_VERSION 119
#endif

View File

@ -320,19 +320,20 @@ void *setPositionNew(uintptr_t label, cocos2d::Vec2 const& position) {
LOGD("LOG MESSAGE: %.2f %.2f", position.x, position.y);
LOGD("Difference: %p", (void *)difference);
//if (position.y >= 55.50 && position.y <= 56.50 && difference <= 0x1000) {
if (position.y >= 37.5 && position.y <= 39.5 && difference <= 0x1000) {
if ((position.y >= 37.5 && position.y <= 39.5 && difference <= 0x1300)
|| (position.y >= 55.00 && position.y <= 56.00 && difference <= 0x1300)) {
float newPosX = position.x + 125.0;
LOGD("Moved log text from %.2f to %.2f", position.x, newPosX);
LOGD("Moved log text from %.2f to %.2f", position.x, newPosX);
cocos2d::Vec2 newPosition = cocos2d::Vec2(newPosX, 66.50);
return setPositionHooked(label, newPosition);
}
else if (difference <= 0x200 && position.x == 70.00) {
else if (difference <= 0x400 && position.x == 70.00) {
LOGD("Moving left-aligned name down in the log.");
auto newY = position.y;
cocos2d::Vec2 newPosition = cocos2d::Vec2(position.x, newY);
return setPositionHooked(label, newPosition);
}
else if (difference <= 0x200 && position.x == 500.00) { // Names on the right
else if (difference <= 0x400 && position.x == 500.00) { // Names on the right
LOGD("Moving name further to the right in log.");
auto newX = position.x + 200;
//auto newY = position.y - 15.0;
@ -340,7 +341,7 @@ void *setPositionNew(uintptr_t label, cocos2d::Vec2 const& position) {
cocos2d::Vec2 newPosition = cocos2d::Vec2(newX, newY);
return setPositionHooked(label, newPosition);
}
else if (difference <= 0x200 && position.x == 280.00) { // Names in the center, 280.00?
else if (difference <= 0x400 && position.x == 280.00) { // Names in the center, 280.00?
LOGD("Moving center name to the left in the log.");
auto newX = 71.50;
auto newY = position.y;
@ -390,12 +391,18 @@ cocos2d::Size (*lbGetViewPositionHooked)(float x, float y);
cocos2d::Size lbGetViewPositionNew(float x, float y) {
uintptr_t addr = reinterpret_cast<uintptr_t>(__builtin_extract_return_addr(__builtin_return_address(0)));
uintptr_t difference = addr - storyCharaUnitonTextHomeOffset;
//LOGI("Difference (viewPos): %p, addr: %p", (void*)difference, (void*)addr);
//LOGD("Difference (viewPos): %p, addr: %p", (void*)difference, (void*)addr);
if (storyCharaUnitonTextHomeOffset != 0 && addr >= storyCharaUnitonTextHomeOffset) {
if (difference <= 0x1000) {
if (difference <= 0x1300) {
auto oldx = x;
auto oldy = y;
if (x > -100.0) {
x = -120.0;
}
if (x == -100.0) {
x = -250.0;
}
x = x - 30.0;
y = y - 30.0;
LOGD("Set live2d subtitle dimensions from (%f, %f) to (%f, %f).", oldx, oldy, x, y);