New Logo + Background!
|
@ -40,6 +40,9 @@
|
|||
* `Render Fire In Third-Person` (Enabled By Default)
|
||||
* `Improved Water Rendering` (Enabled By Default)
|
||||
* `Classic Item Count UI` (Enabled By Default)
|
||||
* `Allow High-Resolution Title` (Enabled By Default)
|
||||
* `Improved Classic Title Positioning` (Enabled By Default)
|
||||
* `Use Updated Title` (Enabled By Default)
|
||||
* Existing Functionality (All Enabled By Default)
|
||||
* `Fix Screen Rendering When Hiding HUD`
|
||||
* `Sanitize Usernames`
|
||||
|
@ -73,6 +76,7 @@
|
|||
* Fix Furnace Visual Bug When Using Lava Bucket As Fuel
|
||||
* `overwrite_calls` Now Scans VTables
|
||||
* Unify Server/Client Builds
|
||||
* Controller Support Removed
|
||||
|
||||
**2.5.3**
|
||||
* Add `Replace Block Highlight With Outline` Feature Flag (Enabled By Default)
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
project(images)
|
||||
|
||||
# Logo
|
||||
install(
|
||||
FILES "modern_logo.png"
|
||||
DESTINATION "${MCPI_INSTALL_DIR}/data/images/gui"
|
||||
)
|
||||
|
||||
# Title Background
|
||||
install(
|
||||
FILES "background.png"
|
||||
|
@ -14,7 +20,7 @@ install(
|
|||
)
|
||||
|
||||
# Icon
|
||||
set(ICON_DIR "${MCPI_SHARE_DIR}/icons/hicolor/512x512/apps")
|
||||
set(ICON_DIR "${MCPI_SHARE_DIR}/icons/hicolor/1024x1024/apps")
|
||||
install(
|
||||
FILES "icon.png"
|
||||
DESTINATION "${ICON_DIR}"
|
||||
|
|
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 139 KiB |
BIN
images/icon.png
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 97 KiB |
BIN
images/modern_logo.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
images/start.png
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 115 KiB |
|
@ -102,4 +102,7 @@ TRUE Log Chat Messages
|
|||
TRUE Log Game Status
|
||||
TRUE Screenshot Support
|
||||
TRUE Fix Camera Functionality
|
||||
TRUE Property Scale Animated Textures
|
||||
TRUE Property Scale Animated Textures
|
||||
TRUE Allow High-Resolution Title
|
||||
TRUE Improved Classic Title Positioning
|
||||
TRUE Use Updated Title
|
|
@ -283,7 +283,7 @@ static void glfw_click(__attribute__((unused)) GLFWwindow *window, const int but
|
|||
// Pass Mouse Scroll To SDL
|
||||
static void glfw_scroll(__attribute__((unused)) GLFWwindow *window, __attribute__((unused)) double xoffset, double yoffset) {
|
||||
if (is_interactable && yoffset != 0) {
|
||||
int sdl_button = yoffset > 0 ? SDL_BUTTON_WHEELUP : SDL_BUTTON_WHEELDOWN;
|
||||
const int sdl_button = yoffset > 0 ? SDL_BUTTON_WHEELUP : SDL_BUTTON_WHEELDOWN;
|
||||
click_event(sdl_button, false);
|
||||
click_event(sdl_button, true);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ void SDL_WM_SetCaption(const char *title, __attribute__((unused)) const char *ic
|
|||
glfwWindowHintString(GLFW_WAYLAND_APP_ID, MCPI_APP_ID);
|
||||
|
||||
// Create Window
|
||||
glfw_window = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, title, NULL, NULL);
|
||||
glfw_window = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, title, nullptr, nullptr);
|
||||
if (!glfw_window) {
|
||||
ERR("Unable To Create GLFW Window");
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ set(SRC
|
|||
src/atlas/atlas.cpp
|
||||
# title-screen
|
||||
src/title-screen/title-screen.cpp
|
||||
src/title-screen/splashes.cpp
|
||||
src/title-screen/splashes.txt # Show In IDE
|
||||
src/title-screen/welcome.cpp
|
||||
# skin
|
||||
|
|
|
@ -25,4 +25,6 @@ void misc_run_on_language_setup(const std::function<void()> &func);
|
|||
void misc_run_on_game_key_press(const std::function<bool(Minecraft *, int)> &func);
|
||||
void misc_run_on_key_press(const std::function<bool(Minecraft *, int)> &func);
|
||||
void misc_run_on_creative_inventory_setup(const std::function<void(FillingContainer *)> &function);
|
||||
void misc_run_on_swap_buffers(const std::function<void()> &function);
|
||||
void misc_run_on_swap_buffers(const std::function<void()> &function);
|
||||
|
||||
static constexpr int line_height = 8;
|
|
@ -41,10 +41,9 @@ static std::vector<std::string> get_debug_info(const Minecraft *minecraft) {
|
|||
}
|
||||
|
||||
// Render Text With Background
|
||||
static uint32_t debug_background_color = 0x90505050;
|
||||
static int debug_text_color = 0xe0e0e0;
|
||||
static int debug_background_padding = 1;
|
||||
static int line_height = 8;
|
||||
static constexpr uint32_t debug_background_color = 0x90505050;
|
||||
static constexpr int debug_text_color = 0xe0e0e0;
|
||||
static constexpr int debug_background_padding = 1;
|
||||
static void render_debug_line(Gui *gui, std::string &line, const int x, const int y) {
|
||||
// Draw Background
|
||||
const int width = gui->minecraft->font->width(line);
|
||||
|
@ -57,8 +56,8 @@ static void render_debug_line(Gui *gui, std::string &line, const int x, const in
|
|||
}
|
||||
// Draw Debug Information
|
||||
static bool debug_info_shown = false;
|
||||
static int debug_margin = 2;
|
||||
static int debug_line_padding = 1;
|
||||
static constexpr int debug_margin = 2;
|
||||
static constexpr int debug_line_padding = 1;
|
||||
static void Gui_renderDebugInfo_injection(__attribute__((unused)) Gui_renderDebugInfo_t original, Gui *self) {
|
||||
if (debug_info_shown) {
|
||||
std::vector<std::string> info = get_debug_info(self->minecraft);
|
||||
|
|
|
@ -29,14 +29,13 @@ static void create_world(Minecraft *minecraft, std::string name, bool is_creativ
|
|||
CUSTOM_VTABLE(create_world_screen, Screen) {
|
||||
TextInputScreen::setup<CreateWorldScreen>(vtable);
|
||||
// Constants
|
||||
static int line_height = 8;
|
||||
static int bottom_padding = 4;
|
||||
static int inner_padding = 4;
|
||||
static int description_padding = 4;
|
||||
static int title_padding = 8;
|
||||
static int button_height = 24;
|
||||
static int content_y_offset_top = (title_padding * 2) + line_height;
|
||||
static int content_y_offset_bottom = button_height + (bottom_padding * 2);
|
||||
static constexpr int bottom_padding = 4;
|
||||
static constexpr int inner_padding = 4;
|
||||
static constexpr int description_padding = 4;
|
||||
static constexpr int title_padding = 8;
|
||||
static constexpr int button_height = 24;
|
||||
static constexpr int content_y_offset_top = (title_padding * 2) + line_height;
|
||||
static constexpr int content_y_offset_bottom = button_height + (bottom_padding * 2);
|
||||
// Init
|
||||
static Screen_init_t original_init = vtable->init;
|
||||
vtable->init = [](Screen *super) {
|
||||
|
|
|
@ -15,16 +15,15 @@
|
|||
#define INFO_ID_START 2
|
||||
|
||||
// Constants
|
||||
static int line_button_padding = 8;
|
||||
static int line_height = 8;
|
||||
static int line_button_height = (line_button_padding * 2) + line_height;
|
||||
static int padding = 4;
|
||||
static int bottom_padding = padding;
|
||||
static int inner_padding = padding;
|
||||
static int title_padding = 8;
|
||||
static int info_text_y_offset = (line_button_height - line_height) / 2;
|
||||
static int content_y_offset_top = (title_padding * 2) + line_height;
|
||||
static int content_y_offset_bottom = (bottom_padding * 2) + line_button_height;
|
||||
static constexpr int line_button_padding = 8;
|
||||
static constexpr int line_button_height = (line_button_padding * 2) + line_height;
|
||||
static constexpr int padding = 4;
|
||||
static constexpr int bottom_padding = padding;
|
||||
static constexpr int inner_padding = padding;
|
||||
static constexpr int title_padding = 8;
|
||||
static constexpr int info_text_y_offset = (line_button_height - line_height) / 2;
|
||||
static constexpr int content_y_offset_top = (title_padding * 2) + line_height;
|
||||
static constexpr int content_y_offset_bottom = (bottom_padding * 2) + line_button_height;
|
||||
|
||||
// Extra Version Info
|
||||
static std::string extra_version_info =
|
||||
|
|
177
mods/src/title-screen/splashes.cpp
Normal file
|
@ -0,0 +1,177 @@
|
|||
#include <fstream>
|
||||
#include <cmath>
|
||||
|
||||
#include <libreborn/libreborn.h>
|
||||
#include <symbols/minecraft.h>
|
||||
#include <GLES/gl.h>
|
||||
|
||||
#include <mods/misc/misc.h>
|
||||
#include <mods/title-screen/title-screen.h>
|
||||
|
||||
#include "title-screen-internal.h"
|
||||
|
||||
// Load
|
||||
void title_screen_load_splashes(std::vector<std::string> &splashes) {
|
||||
std::ifstream stream("data/splashes.txt");
|
||||
if (stream.good()) {
|
||||
std::string line;
|
||||
while (std::getline(stream, line)) {
|
||||
if (line.length() > 0) {
|
||||
splashes.push_back(line);
|
||||
}
|
||||
}
|
||||
stream.close();
|
||||
} else {
|
||||
WARN("Unable To Load Splashes");
|
||||
}
|
||||
}
|
||||
|
||||
// Position Splash Text
|
||||
struct SplashLine {
|
||||
static constexpr float x_offset = 64;
|
||||
float y_factor;
|
||||
static constexpr float angle = -20;
|
||||
static constexpr float max_scale = 2.0f;
|
||||
static constexpr float min_scale = 0.6f;
|
||||
static constexpr float padding = (1.0f / 18.0f);
|
||||
const StartMenuScreen *screen;
|
||||
explicit SplashLine(const StartMenuScreen *screen_, const float y_factor_): y_factor(y_factor_), screen(screen_) {}
|
||||
// Get Origin
|
||||
[[nodiscard]] float origin_x() const {
|
||||
return (float(screen->width) / 2.0f) + x_offset;
|
||||
}
|
||||
[[nodiscard]] float get_region() const {
|
||||
float region = float(screen->start_button.y - version_text_bottom);
|
||||
if (region < 0) {
|
||||
region = 0;
|
||||
}
|
||||
return region;
|
||||
}
|
||||
[[nodiscard]] float origin_y() const {
|
||||
return float(version_text_bottom) + (get_region() / y_factor);
|
||||
}
|
||||
[[nodiscard]] static float angle_rad() {
|
||||
return angle * float(M_PI / 180.0f);
|
||||
}
|
||||
// Find Endpoint
|
||||
[[nodiscard]] float from_x(float x) const {
|
||||
x -= origin_x();
|
||||
return x / std::cos(angle_rad());
|
||||
}
|
||||
[[nodiscard]] float from_y(float y) const {
|
||||
y -= origin_y();
|
||||
return y / std::sin(angle_rad());
|
||||
}
|
||||
[[nodiscard]] float end() const {
|
||||
const float end_x = float(screen->width) * (1 - padding);
|
||||
const float end_y = float(screen->width) * padding;
|
||||
return std::min(from_x(end_x), from_y(end_y));
|
||||
}
|
||||
// Get Scale
|
||||
[[nodiscard]] float get_max_scale(bool &bad_y_factor) const {
|
||||
float region = get_region();
|
||||
region /= y_factor;
|
||||
const float splash_line_height = region * std::cos(angle_rad());
|
||||
float scale = splash_line_height / line_height;
|
||||
if (scale > max_scale) {
|
||||
scale = max_scale;
|
||||
bad_y_factor = true;
|
||||
}
|
||||
if (scale < min_scale) {
|
||||
scale = 0;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
};
|
||||
|
||||
// Add Splashes
|
||||
static std::string current_splash;
|
||||
static bool draw_splash(StartMenuScreen *screen, const float y_factor, const bool allow_bad_y_factor) {
|
||||
// Position
|
||||
const SplashLine line(screen, y_factor);
|
||||
const float x = line.origin_x();
|
||||
const float y = line.origin_y();
|
||||
// Choose Scale
|
||||
const float max_width = line.end();
|
||||
bool bad_y_factor = false;
|
||||
float scale = line.get_max_scale(bad_y_factor);
|
||||
if (bad_y_factor && !allow_bad_y_factor) {
|
||||
// Try With Another Y-Factor
|
||||
return false;
|
||||
}
|
||||
const int text_width = screen->font->width(current_splash);
|
||||
float splash_width = float(text_width) * scale;
|
||||
if (splash_width > float(max_width)) {
|
||||
const float multiplier = (float(max_width) / splash_width);
|
||||
scale *= multiplier;
|
||||
splash_width *= multiplier;
|
||||
}
|
||||
// Position
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, 0.0f);
|
||||
// Rotate
|
||||
glRotatef(SplashLine::angle, 0.0f, 0.0f, 1.0f);
|
||||
// Oscillate
|
||||
const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f;
|
||||
const float oscillation = (scale / SplashLine::max_scale) * 0.1f;
|
||||
scale = scale - Mth::abs(oscillation * Mth::sin(2.0f * float(M_PI) * timeMS));
|
||||
// Scale
|
||||
glTranslatef(splash_width / 2.0f, 0, 0);
|
||||
glScalef(scale, scale, 1);
|
||||
glTranslatef(-text_width / 2.0f, 0, 0);
|
||||
// Render
|
||||
float y_offset = float(-line_height) / 2.0f;
|
||||
y_offset += 1; // Make It Look Vertically Centered
|
||||
screen->drawString(screen->font, current_splash, 0, y_offset, 0xffff00);
|
||||
// Finish
|
||||
glPopMatrix();
|
||||
return true;
|
||||
}
|
||||
static void StartMenuScreen_render_injection(StartMenuScreen_render_t original, StartMenuScreen *screen, const int mouse_x, const int mouse_y, const float param_1) {
|
||||
// Call Original Method
|
||||
original(screen, mouse_x, mouse_y, param_1);
|
||||
|
||||
// Load Splashes
|
||||
static std::vector<std::string> splashes;
|
||||
static bool splashes_loaded = false;
|
||||
if (!splashes_loaded) {
|
||||
// Mark As Loaded
|
||||
splashes_loaded = true;
|
||||
// Load
|
||||
title_screen_load_splashes(splashes);
|
||||
}
|
||||
|
||||
// Display Splash
|
||||
if (!splashes.empty()) {
|
||||
// Pick Splash
|
||||
if (current_splash.empty()) {
|
||||
current_splash = splashes[rand() % splashes.size()];
|
||||
}
|
||||
// Draw
|
||||
float y_factor = 2.0f;
|
||||
bool allow_bad_y_factor = false;
|
||||
while (true) {
|
||||
if (draw_splash(screen, y_factor, allow_bad_y_factor)) {
|
||||
break;
|
||||
} else {
|
||||
y_factor++;
|
||||
allow_bad_y_factor = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset Splash When Screen Is Opened
|
||||
static void StartMenuScreen_init_injection_splash(StartMenuScreen_init_t original, StartMenuScreen *screen) {
|
||||
// Call Original Method
|
||||
original(screen);
|
||||
// Reset Splash
|
||||
current_splash = "";
|
||||
}
|
||||
|
||||
// Init
|
||||
void _init_splashes() {
|
||||
overwrite_calls(StartMenuScreen_render, StartMenuScreen_render_injection);
|
||||
overwrite_calls(StartMenuScreen_init, StartMenuScreen_init_injection_splash);
|
||||
// Init Random
|
||||
srand(time(nullptr));
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
__attribute__((visibility("internal"))) void _init_welcome();
|
||||
__attribute__((visibility("internal"))) extern int version_text_bottom;
|
||||
__attribute__((visibility("internal"))) void _init_splashes();
|
||||
|
|
|
@ -8,13 +8,14 @@
|
|||
#include <mods/feature/feature.h>
|
||||
#include <mods/init/init.h>
|
||||
#include <mods/compat/compat.h>
|
||||
#include <mods/touch/touch.h>
|
||||
#include <mods/title-screen/title-screen.h>
|
||||
#include <mods/misc/misc.h>
|
||||
|
||||
#include "title-screen-internal.h"
|
||||
|
||||
// Improved Title Screen Background
|
||||
static void StartMenuScreen_render_Screen_renderBackground_injection(Screen *screen) {
|
||||
template <typename Self>
|
||||
static void StartMenuScreen_renderBackground_injection(Self *screen) {
|
||||
// Draw
|
||||
const Minecraft *minecraft = screen->minecraft;
|
||||
Textures *textures = minecraft->textures;
|
||||
|
@ -51,71 +52,74 @@ static void StartMenuScreen_buttonClicked_injection(StartMenuScreen_buttonClicke
|
|||
}
|
||||
}
|
||||
|
||||
// Add Splashes
|
||||
void title_screen_load_splashes(std::vector<std::string> &splashes) {
|
||||
std::ifstream stream("data/splashes.txt");
|
||||
if (stream.good()) {
|
||||
std::string line;
|
||||
while (std::getline(stream, line)) {
|
||||
if (line.length() > 0) {
|
||||
splashes.push_back(line);
|
||||
}
|
||||
}
|
||||
stream.close();
|
||||
} else {
|
||||
WARN("Unable To Load Splashes");
|
||||
}
|
||||
}
|
||||
static Screen *last_screen = nullptr;
|
||||
static std::string current_splash;
|
||||
static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) {
|
||||
// Fix High-Resolution Title
|
||||
static constexpr int title_width = 256;
|
||||
static constexpr int title_height = 64;
|
||||
static Texture *StartMenuScreen_render_Textures_getTemporaryTextureData_injection(Textures *self, uint id) {
|
||||
// Call Original Method
|
||||
Screen_render->get(false)(screen, x, y, param_1);
|
||||
const Texture *out = self->getTemporaryTextureData(id);
|
||||
// Patch
|
||||
static Texture ret;
|
||||
ret = *out;
|
||||
ret.width = title_width;
|
||||
ret.height = title_height;
|
||||
return &ret;
|
||||
}
|
||||
static float StartMenuScreen_render_Mth_min_injection(__attribute__((unused)) float a, const float b) {
|
||||
return b;
|
||||
}
|
||||
|
||||
// Load Splashes
|
||||
static std::vector<std::string> splashes;
|
||||
static bool splashes_loaded = false;
|
||||
if (!splashes_loaded) {
|
||||
// Mark As Loaded
|
||||
splashes_loaded = true;
|
||||
// Load
|
||||
title_screen_load_splashes(splashes);
|
||||
// Track Version Text Y
|
||||
int version_text_bottom;
|
||||
static int (*adjust_version_y)(const StartMenuScreen *) = nullptr;
|
||||
static void StartMenuScreen_render_GuiComponent_drawString_injection(GuiComponent *self, Font *font, const std::string &text, int x, int y, int color) {
|
||||
// Adjust Position
|
||||
if (adjust_version_y) {
|
||||
y = adjust_version_y((StartMenuScreen *) self);
|
||||
}
|
||||
// Draw
|
||||
self->drawString(font, text, x, y, color);
|
||||
// Store Position
|
||||
version_text_bottom = y + line_height;
|
||||
}
|
||||
|
||||
// Display Splash
|
||||
if (!splashes.empty()) {
|
||||
// Pick Splash
|
||||
if (last_screen != screen) {
|
||||
last_screen = screen;
|
||||
current_splash = splashes[rand() % splashes.size()];
|
||||
}
|
||||
// Choose Position
|
||||
const float multiplier = touch_gui ? 0.5f : 1.0f;
|
||||
const float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier);
|
||||
const float splash_y = 4.0f + (36.0f * multiplier);
|
||||
constexpr float max_width = 86;
|
||||
constexpr float max_scale = 2.0f;
|
||||
// Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718)
|
||||
glPushMatrix();
|
||||
// Position
|
||||
glTranslatef(splash_x, splash_y, 0.0f);
|
||||
glRotatef(-20.0f, 0.0f, 0.0f, 1.0f);
|
||||
// Scale
|
||||
const int textWidth = screen->font->width(current_splash);
|
||||
const float timeMS = float(Common::getTimeMs() % 1000) / 1000.0f;
|
||||
float scale = max_scale - Mth::abs(0.1f * Mth::sin(2.0f * float(M_PI) * timeMS));
|
||||
const float real_text_width = textWidth * max_scale;
|
||||
if (real_text_width > max_width) {
|
||||
scale *= max_width / real_text_width;
|
||||
}
|
||||
scale *= multiplier;
|
||||
glScalef(scale, scale, scale);
|
||||
// Render
|
||||
static int line_height = 8;
|
||||
screen->drawCenteredString(screen->font, current_splash, 0, -(float(line_height) / 2), 0xffff00);
|
||||
// Finish
|
||||
glPopMatrix();
|
||||
}
|
||||
// Modern Logo
|
||||
static constexpr float modern_title_scale = 0.75f;
|
||||
static constexpr int modern_title_width = int(title_width * modern_title_scale);
|
||||
static constexpr int modern_title_height = int(title_height * modern_title_scale);
|
||||
static constexpr int version_text_y_offset = -6;
|
||||
static int get_title_y(const StartMenuScreen *screen) {
|
||||
float y = float(screen->start_button.y - modern_title_height);
|
||||
y *= (5.0f / 24.0f);
|
||||
y = ceilf(y);
|
||||
return int(y);
|
||||
}
|
||||
static int get_version_y(const StartMenuScreen *screen) {
|
||||
int y = get_title_y(screen);
|
||||
y += modern_title_height;
|
||||
y += version_text_y_offset;
|
||||
return y;
|
||||
}
|
||||
static void StartMenuScreen_render_Screen_renderBackground_injection(StartMenuScreen *self) {
|
||||
// Call Original Method
|
||||
self->renderBackground();
|
||||
// Draw Logo
|
||||
self->minecraft->textures->loadAndBindTexture(Strings::title_texture_classic);
|
||||
const float x = float(self->width) / 2;
|
||||
const float y = float(get_title_y(self));
|
||||
constexpr int w = modern_title_width / 2;
|
||||
constexpr int h = modern_title_height;
|
||||
Tesselator& t = Tesselator::instance;
|
||||
glColor4f(1, 1, 1, 1);
|
||||
t.begin(7);
|
||||
t.vertexUV(x - w, y + h, self->z, 0, 1);
|
||||
t.vertexUV(x + w, y + h, self->z, 1, 1);
|
||||
t.vertexUV(x + w, y, self->z, 1, 0);
|
||||
t.vertexUV(x - w, y, self->z, 0, 0);
|
||||
t.draw();
|
||||
}
|
||||
static Texture *StartMenuScreen_render_Textures_getTemporaryTextureData_injection_modern(__attribute__((unused)) Textures *self, __attribute__((unused)) uint id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Init
|
||||
|
@ -123,8 +127,8 @@ void init_title_screen() {
|
|||
// Improved Title Screen Background
|
||||
if (feature_has("Add Title Screen Background", server_disabled)) {
|
||||
// Switch Background
|
||||
overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||
overwrite_call((void *) 0x3dee0, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||
patch_vtable(StartMenuScreen_renderBackground, StartMenuScreen_renderBackground_injection<StartMenuScreen>);
|
||||
patch_vtable(Touch_StartMenuScreen_renderBackground, StartMenuScreen_renderBackground_injection<Touch_StartMenuScreen>);
|
||||
// Text Color
|
||||
patch_address((void *) 0x397ac, (void *) 0xffffffff);
|
||||
patch_address((void *) 0x3e10c, (void *) 0xffffffff);
|
||||
|
@ -160,12 +164,35 @@ void init_title_screen() {
|
|||
overwrite_calls(StartMenuScreen_buttonClicked, StartMenuScreen_buttonClicked_injection);
|
||||
}
|
||||
|
||||
// Modern Logo
|
||||
const bool modern_logo = feature_has("Use Updated Title", server_disabled);
|
||||
if (modern_logo) {
|
||||
const char *new_path = "gui/modern_logo.png";
|
||||
patch_address((void *) &Strings::title_texture_classic, (void *) new_path);
|
||||
patch_address((void *) &Strings::title_texture_touch, (void *) new_path);
|
||||
}
|
||||
|
||||
// High-Resolution Title
|
||||
if (feature_has("Allow High-Resolution Title", server_disabled) || modern_logo) {
|
||||
// Touch
|
||||
overwrite_call((void *) 0x3df2c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x3df98, (void *) StartMenuScreen_render_Mth_min_injection);
|
||||
// Classic
|
||||
overwrite_call((void *) 0x3956c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection);
|
||||
overwrite_call((void *) 0x395d8, (void *) StartMenuScreen_render_Mth_min_injection);
|
||||
}
|
||||
|
||||
// Better Scaling And Position
|
||||
if (feature_has("Improved Classic Title Positioning", server_disabled)) {
|
||||
overwrite_call((void *) 0x3956c, (void *) StartMenuScreen_render_Textures_getTemporaryTextureData_injection_modern);
|
||||
overwrite_call((void *) 0x39528, (void *) StartMenuScreen_render_Screen_renderBackground_injection);
|
||||
adjust_version_y = get_version_y;
|
||||
}
|
||||
overwrite_call((void *) 0x39728, (void *) StartMenuScreen_render_GuiComponent_drawString_injection);
|
||||
|
||||
// Add Splashes
|
||||
if (feature_has("Add Splashes", server_disabled)) {
|
||||
overwrite_call((void *) 0x39764, (void *) StartMenuScreen_render_Screen_render_injection);
|
||||
overwrite_call((void *) 0x3e0c4, (void *) StartMenuScreen_render_Screen_render_injection);
|
||||
// Init Random
|
||||
srand(time(nullptr));
|
||||
_init_splashes();
|
||||
}
|
||||
|
||||
// Init Welcome Screen
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
#include <mods/home/home.h>
|
||||
#include <mods/touch/touch.h>
|
||||
#include <mods/options/info.h>
|
||||
#include <mods/misc/misc.h>
|
||||
|
||||
#include "title-screen-internal.h"
|
||||
|
||||
// Constants
|
||||
static std::string line1 = "Welcome to " MCPI_APP_TITLE " v" MCPI_VERSION "!";
|
||||
static int line_height = 8;
|
||||
static int button_width = 120;
|
||||
static int button_height = 24;
|
||||
static int line_padding = 28;
|
||||
static int button_padding = 4;
|
||||
static constexpr int button_width = 120;
|
||||
static constexpr int button_height = 24;
|
||||
static constexpr int line_padding = 28;
|
||||
static constexpr int button_padding = 4;
|
||||
|
||||
// Track Whether To Show Screen
|
||||
static std::string get_tracker_file() {
|
||||
|
|
33
scripts/screenshot.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Setup
|
||||
export XDG_SESSION_TYPE=x11
|
||||
unset MCPI_GUI_SCALE
|
||||
export PATH="$(pwd)/out/host/usr/bin:${PATH}"
|
||||
|
||||
# Setup Feature Flags
|
||||
export MCPI_FEATURE_FLAGS="$(
|
||||
# Get All Feature Flags
|
||||
minecraft-pi-reborn --print-available-feature-flags |
|
||||
# Find Enabled Feature Flags
|
||||
grep '^TRUE ' | cut -f2- -d' ' |
|
||||
# Disable Flags
|
||||
grep -v 'Add Welcome Screen' |
|
||||
grep -v 'Improved Cursor Rendering' |
|
||||
# Format
|
||||
tr '\n' '|'
|
||||
)"
|
||||
|
||||
# Run
|
||||
minecraft-pi-reborn --default --no-cache &
|
||||
PID="$!"
|
||||
|
||||
# Screenshot
|
||||
sleep 2
|
||||
gnome-screenshot --window --file=images/start.png
|
||||
|
||||
# Kill
|
||||
kill "${PID}"
|
||||
wait "${PID}"
|
|
@ -119,6 +119,7 @@ set(SRC
|
|||
src/gui/screens/OptionsScreen.def
|
||||
src/gui/screens/TextEditScreen.def
|
||||
src/gui/screens/StartMenuScreen.def
|
||||
src/gui/screens/Touch_StartMenuScreen.def
|
||||
src/gui/screens/ProgressScreen.def
|
||||
src/gui/screens/Touch_SelectWorldScreen.def
|
||||
src/gui/screens/PaneCraftingScreen.def
|
||||
|
|
|
@ -2,5 +2,6 @@ extends Screen;
|
|||
|
||||
vtable 0x105188;
|
||||
|
||||
property Button start_button = 0x48;
|
||||
property Button options_button = 0x98;
|
||||
property Button create_button = 0xc0;
|
||||
|
|
3
symbols/src/gui/screens/Touch_StartMenuScreen.def
Normal file
|
@ -0,0 +1,3 @@
|
|||
extends Screen;
|
||||
|
||||
vtable 0x1058a8;
|
|
@ -9,4 +9,6 @@ static-property char *gfx_lowquality_options_txt_name = 0x135d88; // "gfx_lowqua
|
|||
static-property char *classic_create_button_text = 0x39bec; // "Create"
|
||||
static-property char creative_mode_description[31] = 0x104492; // "Unlimited resources and flying"
|
||||
static-property char survival_mode_description[34] = 0x104470; // "Mobs, health and gather resources"
|
||||
static-property char *text_wrapping_delimiter = 0x253d0; // " \n\t\r"
|
||||
static-property char *text_wrapping_delimiter = 0x253d0; // " \n\t\r"
|
||||
static-property char *title_texture_touch = 0x3e0fc; // "gui/pi_title.png"
|
||||
static-property char *title_texture_classic = 0x39798; // "gui/pi_title.png"
|
|
@ -2,3 +2,4 @@ method void tick(bool param_1) = 0x531c4;
|
|||
method int loadAndBindTexture(const std::string &name) = 0x539cc;
|
||||
method int assignTexture(const std::string &name, uchar *data) = 0x5354c;
|
||||
method void addDynamicTexture(DynamicTexture *texture) = 0x534f8;
|
||||
method Texture *getTemporaryTextureData(uint id) = 0x53168;
|