mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Minor edits to Console.cpp and Logging.cpp
Added procedure and macros for unsigned integer comparison to lib.math.h.
This commit is contained in:
@@ -5,6 +5,17 @@
|
||||
Numbers...
|
||||
*/
|
||||
|
||||
#define above(a, b) (unsigned_comp(a, b) > 0)
|
||||
#define above_equal(a, b) (unsigned_comp(a, b) >= 0)
|
||||
#define below(a, b) (unsigned_comp(a, b) < 0)
|
||||
#define below_equal(a, b) (unsigned_comp(a, b) <= 0)
|
||||
|
||||
procedure unsigned_comp(variable a, variable b) begin
|
||||
if (a bwxor b) then return 0;
|
||||
if (b == 0) then return 1;
|
||||
return 1 if (a / b) else -1;
|
||||
end
|
||||
|
||||
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
|
||||
#define MIN(x, y) ((x < y) * x + (x >= y) * y)
|
||||
#define in_range(x, from, to) (x >= from and x <= to)
|
||||
|
||||
+7
-9
@@ -22,12 +22,10 @@
|
||||
|
||||
#include "Console.h"
|
||||
|
||||
using namespace std;
|
||||
static std::ofstream consoleFile;
|
||||
|
||||
static ofstream consolefile;
|
||||
|
||||
static void _stdcall ConsoleFilePrint(const char* msg) {
|
||||
consolefile << msg << endl;
|
||||
static void __stdcall ConsoleFilePrint(const char* msg) {
|
||||
consoleFile << msg << std::endl;
|
||||
}
|
||||
|
||||
static const DWORD ConsoleHookRet = 0x431871;
|
||||
@@ -49,15 +47,15 @@ static void __declspec(naked) ConsoleHook() {
|
||||
void ConsoleInit() {
|
||||
std::string path = GetConfigString("Misc", "ConsoleOutputPath", "", MAX_PATH);
|
||||
if (!path.empty()) {
|
||||
consolefile.open(path);
|
||||
if (consolefile.is_open()) {
|
||||
consoleFile.open(path);
|
||||
if (consoleFile.is_open()) {
|
||||
MakeJump(0x43186C, ConsoleHook);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleExit() {
|
||||
if (consolefile.is_open()) {
|
||||
consolefile.close();
|
||||
if (consoleFile.is_open()) {
|
||||
consoleFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -23,10 +23,8 @@
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
static int DebugTypes = 0;
|
||||
static ofstream Log;
|
||||
static std::ofstream Log;
|
||||
|
||||
void dlog(const char* a, int type) {
|
||||
if (isDebug && (type == DL_MAIN || (type & DebugTypes))) {
|
||||
@@ -55,7 +53,7 @@ void dlog_f(const char *fmt, int type, ...) {
|
||||
}
|
||||
|
||||
void LoggingInit() {
|
||||
Log.open("sfall-log.txt", ios_base::out | ios_base::trunc);
|
||||
Log.open("sfall-log.txt", std::ios_base::out | std::ios_base::trunc);
|
||||
if (iniGetInt("Debugging", "Init", 0, ddrawIniDef)) {
|
||||
DebugTypes |= DL_INIT;
|
||||
}
|
||||
|
||||
+1
-1
@@ -90,8 +90,8 @@ private:
|
||||
HRESULT hr = pAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &surfaces[0]);
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
dlog_f(" Height: %d,", DL_INIT, lpAllocInfo->dwHeight);
|
||||
dlog_f(" Width: %d,", DL_INIT, lpAllocInfo->dwWidth);
|
||||
dlog_f(" Height: %d,", DL_INIT, lpAllocInfo->dwHeight);
|
||||
dlog_f(" Format: %d", DL_INIT, lpAllocInfo->Format);
|
||||
|
||||
hr = surfaces[0]->GetContainer(IID_IDirect3DTexture9, (void**)&pTex);
|
||||
|
||||
Reference in New Issue
Block a user