mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
Storm's SMemAlloc (FUN_STORM_SMEM_ALLOC, 0x006462E0) and SMemFree (FUN_STORM_SMEM_FREE, 0x00646430), both __stdcall with four arguments, were called by hand in thirteen files, through AddOns::EngineIO's typedefs, local typedefs, Event::Custom's own pair and Frame::Subclass::Allocate. storm/Memory.h now holds Storm::Alloc, with a zero-fill option for the flag bit 3 (Offsets::STORM_SMEM_FLAG_ZERO_FILL), and Storm::Free. Every caller uses them, with the same file and line labels as before; the EngineIO typedefs, Custom's pair and Subclass::Allocate are gone.
38 lines
1.8 KiB
C++
38 lines
1.8 KiB
C++
// This file is part of ClassicAPI.
|
|
//
|
|
// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
|
|
// of the GNU General Public License as published by the Free Software Foundation, either
|
|
// version 3 of the License, or (at your option) any later version.
|
|
//
|
|
// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License along with
|
|
// ClassicAPI. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#pragma once
|
|
|
|
#include <cstddef>
|
|
|
|
// One home for the engine file-I/O and Storm-allocator function-pointer types
|
|
// the addon modules call. These are ABI-critical: FUN_FILE_READ /
|
|
// FUN_FILE_EXISTS / the Storm allocator are all `__stdcall` (callee cleans the
|
|
// stack), and declaring one `__cdecl` by mistake drifts ESP a few bytes per
|
|
// call and kills the process with no crash log. The shape lived in ~6 copies
|
|
// across the addon files; centralize it so the convention cannot drift.
|
|
namespace AddOns::EngineIO {
|
|
|
|
// FUN_FILE_READ (0x00648620) — __stdcall, callee cleans 28 bytes (RET 0x1C).
|
|
// arg0 is an optional archive handle (0 = merged VFS); outSize may be null.
|
|
using FileReadFn = int(__stdcall *)(int unused, const char *path, void **outBuf,
|
|
size_t *outSize, size_t extraBytes,
|
|
int flag1, int flag2);
|
|
|
|
// FUN_FILE_EXISTS (0x00648A30) — __stdcall, RET 8.
|
|
using FileExistsFn = int(__stdcall *)(const char *path, int mode);
|
|
|
|
// Buffers FUN_FILE_READ hands out are freed with Storm::Free (storm/Memory.h).
|
|
|
|
} // namespace AddOns::EngineIO
|