mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
check if pointer-checker is still there on non dev build
This commit is contained in:
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
||||
Terrarum_renewed
|
||||
@@ -1,6 +1,6 @@
|
||||
*Terrarum*
|
||||
|
||||
Copyright (C) 2013-2022 Minjae Song ("CuriousTorvald")
|
||||
Copyright (C) 2013-2023 Minjae Song ("CuriousTorvald")
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -39,6 +39,9 @@ import net.torvald.terrarum.utils.JsonFetcher;
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap;
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
||||
import net.torvald.unsafe.AddressOverflowException;
|
||||
import net.torvald.unsafe.DanglingPointerException;
|
||||
import net.torvald.unsafe.UnsafeHelper;
|
||||
import net.torvald.util.DebugTimers;
|
||||
|
||||
import java.io.File;
|
||||
@@ -71,12 +74,6 @@ public class App implements ApplicationListener {
|
||||
*/
|
||||
public static boolean IS_DEVELOPMENT_BUILD = false;
|
||||
|
||||
{
|
||||
// if -ea flag is set, turn on all the debug prints
|
||||
try { assert (false); }
|
||||
catch (AssertionError e) { IS_DEVELOPMENT_BUILD = true; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
*/
|
||||
@@ -314,23 +311,23 @@ public class App implements ApplicationListener {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// if -ea flag is set, turn on all the debug prints
|
||||
try {
|
||||
assert false;
|
||||
}
|
||||
catch (AssertionError e) {
|
||||
IS_DEVELOPMENT_BUILD = true;
|
||||
}
|
||||
|
||||
|
||||
// print copyright message
|
||||
System.out.println(csiB+GAME_NAME+" "+csiG+getVERSION_STRING()+" "+csiK+"\u2014"+" "+csi0+TerrarumAppConfiguration.COPYRIGHT_DATE_NAME);
|
||||
System.out.println(csiG+TerrarumAppConfiguration.COPYRIGHT_LICENSE_TERMS_SHORT+csi0);
|
||||
|
||||
System.out.println("IS_DEVELOPMENT_BUILD = " + IS_DEVELOPMENT_BUILD);
|
||||
|
||||
try {
|
||||
|
||||
|
||||
// load configs
|
||||
getDefaultDirectory();
|
||||
createDirs();
|
||||
initialiseConfig();
|
||||
readConfigJson();
|
||||
|
||||
setGamepadButtonLabels();
|
||||
|
||||
|
||||
try {
|
||||
processor = GetCpuName.getModelName();
|
||||
}
|
||||
@@ -345,6 +342,26 @@ public class App implements ApplicationListener {
|
||||
}
|
||||
|
||||
|
||||
if (!IS_DEVELOPMENT_BUILD) {
|
||||
var p = UnsafeHelper.INSTANCE.allocate(64);
|
||||
p.destroy();
|
||||
try {
|
||||
p.get(0);
|
||||
}
|
||||
catch (DanglingPointerException | AddressOverflowException e) {
|
||||
throw new RuntimeException("Build Error: App is not Development Build but pointer check is still installed. If the game is a production release, please report this to the developers.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// load configs
|
||||
getDefaultDirectory();
|
||||
createDirs();
|
||||
initialiseConfig();
|
||||
readConfigJson();
|
||||
setGamepadButtonLabels();
|
||||
|
||||
|
||||
ShaderProgram.pedantic = false;
|
||||
|
||||
scr = new TerrarumScreenSize(getConfigInt("screenwidth"), getConfigInt("screenheight"));
|
||||
|
||||
@@ -16,7 +16,7 @@ object CreditSingleton {
|
||||
|
||||
$BULLET Terrarum
|
||||
|
||||
Copyright (C) 2013-2022 CuriousTorvald (minjaesong)
|
||||
Copyright (C) 2013-2023 CuriousTorvald (minjaesong)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -332,7 +332,7 @@ object TerrarumPostProcessor : Disposable {
|
||||
private val currentResStr = "${App.scr.width}x${App.scr.height}"
|
||||
private val safeAreaStr = "TV Safe Area"
|
||||
private val versionStr = "Version ${App.getVERSION_STRING()}"
|
||||
internal val thisIsDebugStr = "${App.GAME_NAME} Develoment Build $versionStr"
|
||||
internal val thisIsDebugStr = "${App.GAME_NAME} Development Build $versionStr"
|
||||
|
||||
/**
|
||||
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
||||
|
||||
@@ -326,6 +326,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
)
|
||||
}
|
||||
|
||||
batch.color = if (App.IS_DEVELOPMENT_BUILD) Toolkit.Theme.COL_MOUSE_UP else Color.LIGHT_GRAY
|
||||
App.fontGame.draw(batch, TerrarumPostProcessor.thisIsDebugStr, 5f, App.scr.height - 24f)
|
||||
|
||||
|
||||
|
||||
@@ -112,8 +112,9 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
||||
// You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit")
|
||||
// appear (e.g. getting garbage values when it fucking shouldn't)
|
||||
|
||||
assert(!destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
|
||||
assert(index in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
|
||||
// using ifs instead of assertions: inactive assert statements still slows down the app
|
||||
if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
|
||||
if (index !in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
|
||||
}
|
||||
|
||||
operator fun get(index: Long): Byte {
|
||||
|
||||
Reference in New Issue
Block a user