2020-11-21 08:58:42 -08:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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 the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2020-11-22 20:31:43 -08:00
|
|
|
#include "ags/shared/ac/common.h"
|
2020-11-27 22:17:15 -08:00
|
|
|
#include "ags/engine/ac/draw.h"
|
|
|
|
#include "ags/engine/ac/gamesetup.h"
|
2020-11-22 20:31:43 -08:00
|
|
|
#include "ags/shared/ac/gamesetupstruct.h"
|
2020-11-27 22:17:15 -08:00
|
|
|
#include "ags/engine/ac/gamestate.h"
|
|
|
|
#include "ags/engine/ac/mouse.h"
|
|
|
|
#include "ags/engine/ac/string.h"
|
|
|
|
#include "ags/engine/ac/system.h"
|
|
|
|
#include "ags/engine/ac/dynobj/scriptsystem.h"
|
|
|
|
#include "ags/engine/debugging/debug_log.h"
|
2020-11-26 14:34:47 -08:00
|
|
|
#include "ags/shared/debugging/out.h"
|
2020-11-27 22:17:15 -08:00
|
|
|
#include "ags/engine/main/engine.h"
|
|
|
|
#include "ags/engine/main/main.h"
|
|
|
|
#include "ags/engine/gfx/graphicsdriver.h"
|
|
|
|
#include "ags/engine/ac/dynobj/cc_audiochannel.h"
|
|
|
|
#include "ags/engine/main/graphics_mode.h"
|
|
|
|
#include "ags/engine/ac/global_debug.h"
|
|
|
|
#include "ags/engine/ac/global_translation.h"
|
|
|
|
#include "ags/engine/media/audio/audio_system.h"
|
2020-11-22 20:31:43 -08:00
|
|
|
#include "ags/shared/util/string_compat.h"
|
2020-11-26 14:34:47 -08:00
|
|
|
#include "ags/shared/debugging/out.h"
|
2020-11-27 22:17:15 -08:00
|
|
|
#include "ags/engine/script/script_api.h"
|
|
|
|
#include "ags/engine/script/script_runtime.h"
|
|
|
|
#include "ags/engine/ac/dynobj/scriptstring.h"
|
2021-02-24 21:19:47 -08:00
|
|
|
#include "ags/globals.h"
|
2021-01-17 20:42:51 -08:00
|
|
|
#include "ags/events.h"
|
2020-11-26 14:34:47 -08:00
|
|
|
|
2020-11-21 16:24:18 -08:00
|
|
|
namespace AGS3 {
|
|
|
|
|
2020-11-21 16:10:55 -08:00
|
|
|
using namespace AGS::Shared;
|
2020-11-21 08:30:51 -08:00
|
|
|
using namespace AGS::Engine;
|
|
|
|
|
|
|
|
extern GameSetup usetup;
|
|
|
|
extern ScriptAudioChannel scrAudioChannel[MAX_SOUND_CHANNELS + 1];
|
2021-02-28 15:07:54 -08:00
|
|
|
|
2020-11-21 08:30:51 -08:00
|
|
|
extern IGraphicsDriver *gfxDriver;
|
2021-02-27 19:21:41 -08:00
|
|
|
|
2020-11-21 08:30:51 -08:00
|
|
|
extern volatile bool switched_away;
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
bool System_HasInputFocus() {
|
|
|
|
return !switched_away;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetColorDepth() {
|
2021-02-28 15:07:54 -08:00
|
|
|
return _GP(scsystem).coldepth;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetOS() {
|
2021-02-28 15:07:54 -08:00
|
|
|
return _GP(scsystem).os;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// [IKM] 2014-09-21
|
|
|
|
// IMPORTANT NOTE on System.ScreenWidth and System.ScreenHeight:
|
|
|
|
// It appears that in AGS these properties were not defining actual window size
|
|
|
|
// in pixels, but rather game frame size, which could include black borders,
|
|
|
|
// in 'native' (unscaled) pixels. This was due the specifics of how graphics
|
|
|
|
// modes were implemented in previous versions.
|
2020-11-21 19:31:48 +00:00
|
|
|
//
|
2020-11-21 08:30:51 -08:00
|
|
|
// Quote from the old manual:
|
|
|
|
// "Returns the actual screen width that the game is running at. If a graphic
|
|
|
|
// filter is in use, the resolution returned will be that before any
|
|
|
|
// stretching by the filter has been applied. If widescreen side borders are
|
|
|
|
// enabled, the screen width reported will include the size of these borders."
|
|
|
|
//
|
|
|
|
// The key words are "the resolution returned will be that BEFORE any
|
|
|
|
// stretching by the filter has been applied".
|
|
|
|
//
|
|
|
|
// Since now the letterbox and pillarbox borders are handled by graphics
|
|
|
|
// renderer and are not part of the game anymore, these properties should
|
|
|
|
// return strictly native game size. This is required for backwards
|
|
|
|
// compatibility.
|
|
|
|
//
|
|
|
|
int System_GetScreenWidth() {
|
2021-02-24 21:19:47 -08:00
|
|
|
return _GP(game).GetGameRes().Width;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetScreenHeight() {
|
2021-02-24 21:19:47 -08:00
|
|
|
return _GP(game).GetGameRes().Height;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetViewportHeight() {
|
2021-02-27 14:44:14 -08:00
|
|
|
return game_to_data_coord(_GP(play).GetMainViewport().GetHeight());
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetViewportWidth() {
|
2021-02-27 14:44:14 -08:00
|
|
|
return game_to_data_coord(_GP(play).GetMainViewport().GetWidth());
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *System_GetVersion() {
|
2021-01-18 13:34:01 -08:00
|
|
|
return CreateNewScriptString(_G(EngineVersion).LongString);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetHardwareAcceleration() {
|
|
|
|
return gfxDriver->HasAcceleratedTransform() ? 1 : 0;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetNumLock() {
|
2021-01-17 20:42:51 -08:00
|
|
|
return (::AGS::g_events->getModifierFlags() & __allegro_KB_NUMLOCK_FLAG) ? 1 : 0;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetCapsLock() {
|
2021-01-17 20:42:51 -08:00
|
|
|
return (::AGS::g_events->getModifierFlags() & __allegro_KB_CAPSLOCK_FLAG) ? 1 : 0;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetScrollLock() {
|
2021-01-17 20:42:51 -08:00
|
|
|
return (::AGS::g_events->getModifierFlags() & __allegro_KB_SCROLOCK_FLAG) ? 1 : 0;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
void System_SetNumLock(int newValue) {
|
2020-11-27 22:17:15 -08:00
|
|
|
// No implementation
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetVsync() {
|
2021-02-28 15:07:54 -08:00
|
|
|
return _GP(scsystem).vsync;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void System_SetVsync(int newValue) {
|
2020-11-21 19:31:48 +00:00
|
|
|
if (ags_stricmp(gfxDriver->GetDriverID(), "D3D9") != 0)
|
2021-02-28 15:07:54 -08:00
|
|
|
_GP(scsystem).vsync = newValue;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetWindowed() {
|
2021-02-28 15:07:54 -08:00
|
|
|
return _GP(scsystem).windowed;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
void System_SetWindowed(int windowed) {
|
2021-02-28 15:07:54 -08:00
|
|
|
if (windowed != _GP(scsystem).windowed)
|
2020-11-21 19:31:48 +00:00
|
|
|
engine_try_switch_windowed_gfxmode();
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetSupportsGammaControl() {
|
2020-11-21 19:31:48 +00:00
|
|
|
return gfxDriver->SupportsGammaControl();
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int System_GetGamma() {
|
2021-02-27 14:44:14 -08:00
|
|
|
return _GP(play).gamma_adjustment;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void System_SetGamma(int newValue) {
|
2020-11-21 19:31:48 +00:00
|
|
|
if ((newValue < 0) || (newValue > 200))
|
|
|
|
quitprintf("!System.Gamma: value must be between 0-200 (not %d)", newValue);
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2021-02-27 14:44:14 -08:00
|
|
|
if (_GP(play).gamma_adjustment != newValue) {
|
2020-11-21 19:31:48 +00:00
|
|
|
debug_script_log("Gamma control set to %d", newValue);
|
2021-02-27 14:44:14 -08:00
|
|
|
_GP(play).gamma_adjustment = newValue;
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
if (gfxDriver->SupportsGammaControl())
|
|
|
|
gfxDriver->SetGamma(newValue);
|
|
|
|
}
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetAudioChannelCount() {
|
|
|
|
return MAX_SOUND_CHANNELS;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
ScriptAudioChannel *System_GetAudioChannels(int index) {
|
|
|
|
if ((index < 0) || (index >= MAX_SOUND_CHANNELS))
|
|
|
|
quit("!System.AudioChannels: invalid sound channel index");
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
return &scrAudioChannel[index];
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetVolume() {
|
2021-02-27 14:44:14 -08:00
|
|
|
return _GP(play).digital_master_volume;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
void System_SetVolume(int newvol) {
|
|
|
|
if ((newvol < 0) || (newvol > 100))
|
|
|
|
quit("!System.Volume: invalid volume - must be from 0-100");
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2021-02-27 14:44:14 -08:00
|
|
|
_GP(play).digital_master_volume = newvol;
|
2021-02-08 22:47:43 +00:00
|
|
|
#if !AGS_PLATFORM_SCUMMVM
|
|
|
|
auto newvol_f = static_cast<float>(newvol) / 100.0;
|
|
|
|
audio_core_set_master_volume(newvol_f);
|
|
|
|
#endif
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
const char *System_GetRuntimeInfo() {
|
|
|
|
String runtimeInfo = GetRuntimeInfo();
|
2020-11-21 08:30:51 -08:00
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
return CreateNewScriptString(runtimeInfo.GetCStr());
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
int System_GetRenderAtScreenResolution() {
|
|
|
|
return usetup.RenderAtScreenRes;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
void System_SetRenderAtScreenResolution(int enable) {
|
|
|
|
usetup.RenderAtScreenRes = enable != 0;
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// Script API Functions
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
2021-02-27 19:21:41 -08:00
|
|
|
|
2020-11-21 08:30:51 -08:00
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetAudioChannelCount(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetAudioChannelCount);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ScriptAudioChannel* (int index)
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetAudioChannels(const RuntimeScriptValue *params, int32_t param_count) {
|
2021-02-27 19:21:41 -08:00
|
|
|
API_SCALL_OBJ_PINT(ScriptAudioChannel, _GP(ccDynamicAudio), System_GetAudioChannels);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetCapsLock(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetCapsLock);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetColorDepth(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetColorDepth);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetGamma(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetGamma);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// void (int newValue)
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetGamma(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetGamma);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2020-11-21 19:31:48 +00:00
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetHardwareAcceleration(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetHardwareAcceleration);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetHasInputFocus(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_BOOL(System_HasInputFocus);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetNumLock(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetNumLock);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// void (int newValue)
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetNumLock(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetNumLock);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetOS(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetOS);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetScreenHeight(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetScreenHeight);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetScreenWidth(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetScreenWidth);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetScrollLock(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetScrollLock);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetSupportsGammaControl(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetSupportsGammaControl);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// const char *()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetVersion(const RuntimeScriptValue *params, int32_t param_count) {
|
2021-02-27 19:21:41 -08:00
|
|
|
API_CONST_SCALL_OBJ(const char, _GP(myScriptStringImpl), System_GetVersion);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetViewportHeight(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetViewportHeight);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetViewportWidth(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetViewportWidth);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetVolume(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetVolume);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// void (int newvol)
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetVolume(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetVolume);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// int ()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetVsync(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetVsync);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// void (int newValue)
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetVsync(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetVsync);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetWindowed(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetWindowed);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetWindowed(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetWindowed);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// const char *()
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetRuntimeInfo(const RuntimeScriptValue *params, int32_t param_count) {
|
2021-02-27 19:21:41 -08:00
|
|
|
API_CONST_SCALL_OBJ(const char, _GP(myScriptStringImpl), System_GetRuntimeInfo);
|
2020-11-21 19:31:48 +00:00
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_GetRenderAtScreenResolution(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_INT(System_GetRenderAtScreenResolution);
|
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_SetRenderAtScreenResolution(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_VOID_PINT(System_SetRenderAtScreenResolution);
|
|
|
|
}
|
|
|
|
|
2021-02-16 19:45:02 -08:00
|
|
|
RuntimeScriptValue Sc_System_Log(const RuntimeScriptValue *params, int32_t param_count) {
|
2020-11-21 19:31:48 +00:00
|
|
|
API_SCALL_SCRIPT_SPRINTF(Sc_System_Log, 2);
|
|
|
|
Debug::Printf(kDbgGroup_Script, (MessageType)params[0].IValue, "%s", scsf_buffer);
|
2021-02-16 19:45:02 -08:00
|
|
|
return RuntimeScriptValue((int32_t)0);
|
2020-11-21 19:31:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RegisterSystemAPI() {
|
2020-11-21 16:24:18 -08:00
|
|
|
ccAddExternalStaticFunction("System::get_AudioChannelCount", Sc_System_GetAudioChannelCount);
|
|
|
|
ccAddExternalStaticFunction("System::geti_AudioChannels", Sc_System_GetAudioChannels);
|
|
|
|
ccAddExternalStaticFunction("System::get_CapsLock", Sc_System_GetCapsLock);
|
|
|
|
ccAddExternalStaticFunction("System::get_ColorDepth", Sc_System_GetColorDepth);
|
|
|
|
ccAddExternalStaticFunction("System::get_Gamma", Sc_System_GetGamma);
|
|
|
|
ccAddExternalStaticFunction("System::set_Gamma", Sc_System_SetGamma);
|
2020-11-21 19:31:48 +00:00
|
|
|
ccAddExternalStaticFunction("System::get_HardwareAcceleration", Sc_System_GetHardwareAcceleration);
|
2020-11-21 16:24:18 -08:00
|
|
|
ccAddExternalStaticFunction("System::get_HasInputFocus", Sc_System_GetHasInputFocus);
|
|
|
|
ccAddExternalStaticFunction("System::get_NumLock", Sc_System_GetNumLock);
|
|
|
|
ccAddExternalStaticFunction("System::set_NumLock", Sc_System_SetNumLock);
|
|
|
|
ccAddExternalStaticFunction("System::get_OperatingSystem", Sc_System_GetOS);
|
2020-11-21 19:31:48 +00:00
|
|
|
ccAddExternalStaticFunction("System::get_RenderAtScreenResolution", Sc_System_GetRenderAtScreenResolution);
|
|
|
|
ccAddExternalStaticFunction("System::set_RenderAtScreenResolution", Sc_System_SetRenderAtScreenResolution);
|
2020-11-21 16:24:18 -08:00
|
|
|
ccAddExternalStaticFunction("System::get_RuntimeInfo", Sc_System_GetRuntimeInfo);
|
|
|
|
ccAddExternalStaticFunction("System::get_ScreenHeight", Sc_System_GetScreenHeight);
|
|
|
|
ccAddExternalStaticFunction("System::get_ScreenWidth", Sc_System_GetScreenWidth);
|
|
|
|
ccAddExternalStaticFunction("System::get_ScrollLock", Sc_System_GetScrollLock);
|
2020-11-21 19:31:48 +00:00
|
|
|
ccAddExternalStaticFunction("System::get_SupportsGammaControl", Sc_System_GetSupportsGammaControl);
|
2020-11-21 16:24:18 -08:00
|
|
|
ccAddExternalStaticFunction("System::get_Version", Sc_System_GetVersion);
|
|
|
|
ccAddExternalStaticFunction("SystemInfo::get_Version", Sc_System_GetVersion);
|
|
|
|
ccAddExternalStaticFunction("System::get_ViewportHeight", Sc_System_GetViewportHeight);
|
|
|
|
ccAddExternalStaticFunction("System::get_ViewportWidth", Sc_System_GetViewportWidth);
|
|
|
|
ccAddExternalStaticFunction("System::get_Volume", Sc_System_GetVolume);
|
|
|
|
ccAddExternalStaticFunction("System::set_Volume", Sc_System_SetVolume);
|
|
|
|
ccAddExternalStaticFunction("System::get_VSync", Sc_System_GetVsync);
|
|
|
|
ccAddExternalStaticFunction("System::set_VSync", Sc_System_SetVsync);
|
|
|
|
ccAddExternalStaticFunction("System::get_Windowed", Sc_System_GetWindowed);
|
|
|
|
ccAddExternalStaticFunction("System::set_Windowed", Sc_System_SetWindowed);
|
|
|
|
ccAddExternalStaticFunction("System::Log^102", Sc_System_Log);
|
2020-11-21 19:31:48 +00:00
|
|
|
|
|
|
|
/* ----------------------- Registering unsafe exports for plugins -----------------------*/
|
|
|
|
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_AudioChannelCount", (void *)System_GetAudioChannelCount);
|
|
|
|
ccAddExternalFunctionForPlugin("System::geti_AudioChannels", (void *)System_GetAudioChannels);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_CapsLock", (void *)System_GetCapsLock);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ColorDepth", (void *)System_GetColorDepth);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_Gamma", (void *)System_GetGamma);
|
|
|
|
ccAddExternalFunctionForPlugin("System::set_Gamma", (void *)System_SetGamma);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_HardwareAcceleration", (void *)System_GetHardwareAcceleration);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_NumLock", (void *)System_GetNumLock);
|
|
|
|
ccAddExternalFunctionForPlugin("System::set_NumLock", (void *)System_SetNumLock);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_OperatingSystem", (void *)System_GetOS);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_RuntimeInfo", (void *)System_GetRuntimeInfo);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ScreenHeight", (void *)System_GetScreenHeight);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ScreenWidth", (void *)System_GetScreenWidth);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ScrollLock", (void *)System_GetScrollLock);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_SupportsGammaControl", (void *)System_GetSupportsGammaControl);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_Version", (void *)System_GetVersion);
|
|
|
|
ccAddExternalFunctionForPlugin("SystemInfo::get_Version", (void *)System_GetVersion);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ViewportHeight", (void *)System_GetViewportHeight);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_ViewportWidth", (void *)System_GetViewportWidth);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_Volume", (void *)System_GetVolume);
|
|
|
|
ccAddExternalFunctionForPlugin("System::set_Volume", (void *)System_SetVolume);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_VSync", (void *)System_GetVsync);
|
|
|
|
ccAddExternalFunctionForPlugin("System::set_VSync", (void *)System_SetVsync);
|
|
|
|
ccAddExternalFunctionForPlugin("System::get_Windowed", (void *)System_GetWindowed);
|
2020-11-21 08:30:51 -08:00
|
|
|
}
|
2020-11-21 16:24:18 -08:00
|
|
|
|
|
|
|
} // namespace AGS3
|