Repository: dyang886/Game-Cheats-Manager Branch: main Commit: f6c50d09f513 Files: 358 Total size: 3.5 MB Directory structure: gitextract_g3w1hlj3/ ├── .github/ │ └── workflows/ │ └── Release to server.yml ├── .gitignore ├── Game Trainers/ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── common/ │ │ ├── CMakeLists.txt │ │ ├── assets/ │ │ │ ├── elevate.xml │ │ │ └── logo.psd │ │ ├── include/ │ │ │ ├── CDPBase.h │ │ │ ├── FL/ │ │ │ │ ├── Enumerations.H │ │ │ │ ├── Fl.H │ │ │ │ ├── Fl_Adjuster.H │ │ │ │ ├── Fl_Anim_GIF_Image.H │ │ │ │ ├── Fl_BMP_Image.H │ │ │ │ ├── Fl_Bitmap.H │ │ │ │ ├── Fl_Box.H │ │ │ │ ├── Fl_Browser.H │ │ │ │ ├── Fl_Browser_.H │ │ │ │ ├── Fl_Button.H │ │ │ │ ├── Fl_Cairo.H │ │ │ │ ├── Fl_Cairo_Window.H │ │ │ │ ├── Fl_Chart.H │ │ │ │ ├── Fl_Check_Browser.H │ │ │ │ ├── Fl_Check_Button.H │ │ │ │ ├── Fl_Choice.H │ │ │ │ ├── Fl_Clock.H │ │ │ │ ├── Fl_Color_Chooser.H │ │ │ │ ├── Fl_Copy_Surface.H │ │ │ │ ├── Fl_Counter.H │ │ │ │ ├── Fl_Device.H │ │ │ │ ├── Fl_Dial.H │ │ │ │ ├── Fl_Double_Window.H │ │ │ │ ├── Fl_Export.H │ │ │ │ ├── Fl_File_Browser.H │ │ │ │ ├── Fl_File_Chooser.H │ │ │ │ ├── Fl_File_Icon.H │ │ │ │ ├── Fl_File_Input.H │ │ │ │ ├── Fl_Fill_Dial.H │ │ │ │ ├── Fl_Fill_Slider.H │ │ │ │ ├── Fl_Flex.H │ │ │ │ ├── Fl_Float_Input.H │ │ │ │ ├── Fl_FormsBitmap.H │ │ │ │ ├── Fl_FormsPixmap.H │ │ │ │ ├── Fl_Free.H │ │ │ │ ├── Fl_GIF_Image.H │ │ │ │ ├── Fl_Gl_Window.H │ │ │ │ ├── Fl_Graphics_Driver.H │ │ │ │ ├── Fl_Grid.H │ │ │ │ ├── Fl_Group.H │ │ │ │ ├── Fl_Help_Dialog.H │ │ │ │ ├── Fl_Help_View.H │ │ │ │ ├── Fl_Hold_Browser.H │ │ │ │ ├── Fl_Hor_Fill_Slider.H │ │ │ │ ├── Fl_Hor_Nice_Slider.H │ │ │ │ ├── Fl_Hor_Slider.H │ │ │ │ ├── Fl_Hor_Value_Slider.H │ │ │ │ ├── Fl_ICO_Image.H │ │ │ │ ├── Fl_Image.H │ │ │ │ ├── Fl_Image_Surface.H │ │ │ │ ├── Fl_Input.H │ │ │ │ ├── Fl_Input_.H │ │ │ │ ├── Fl_Input_Choice.H │ │ │ │ ├── Fl_Int_Input.H │ │ │ │ ├── Fl_JPEG_Image.H │ │ │ │ ├── Fl_Light_Button.H │ │ │ │ ├── Fl_Line_Dial.H │ │ │ │ ├── Fl_Menu.H │ │ │ │ ├── Fl_Menu_.H │ │ │ │ ├── Fl_Menu_Bar.H │ │ │ │ ├── Fl_Menu_Button.H │ │ │ │ ├── Fl_Menu_Item.H │ │ │ │ ├── Fl_Menu_Window.H │ │ │ │ ├── Fl_Multi_Browser.H │ │ │ │ ├── Fl_Multi_Label.H │ │ │ │ ├── Fl_Multiline_Input.H │ │ │ │ ├── Fl_Multiline_Output.H │ │ │ │ ├── Fl_Native_File_Chooser.H │ │ │ │ ├── Fl_Nice_Slider.H │ │ │ │ ├── Fl_Object.H │ │ │ │ ├── Fl_Output.H │ │ │ │ ├── Fl_Overlay_Window.H │ │ │ │ ├── Fl_PDF_File_Surface.H │ │ │ │ ├── Fl_PNG_Image.H │ │ │ │ ├── Fl_PNM_Image.H │ │ │ │ ├── Fl_Pack.H │ │ │ │ ├── Fl_Paged_Device.H │ │ │ │ ├── Fl_Pixmap.H │ │ │ │ ├── Fl_Plugin.H │ │ │ │ ├── Fl_Positioner.H │ │ │ │ ├── Fl_PostScript.H │ │ │ │ ├── Fl_Preferences.H │ │ │ │ ├── Fl_Printer.H │ │ │ │ ├── Fl_Progress.H │ │ │ │ ├── Fl_RGB_Image.H │ │ │ │ ├── Fl_Radio_Button.H │ │ │ │ ├── Fl_Radio_Light_Button.H │ │ │ │ ├── Fl_Radio_Round_Button.H │ │ │ │ ├── Fl_Rect.H │ │ │ │ ├── Fl_Repeat_Button.H │ │ │ │ ├── Fl_Return_Button.H │ │ │ │ ├── Fl_Roller.H │ │ │ │ ├── Fl_Round_Button.H │ │ │ │ ├── Fl_Round_Clock.H │ │ │ │ ├── Fl_SVG_File_Surface.H │ │ │ │ ├── Fl_SVG_Image.H │ │ │ │ ├── Fl_Scheme.H │ │ │ │ ├── Fl_Scheme_Choice.H │ │ │ │ ├── Fl_Scroll.H │ │ │ │ ├── Fl_Scrollbar.H │ │ │ │ ├── Fl_Secret_Input.H │ │ │ │ ├── Fl_Select_Browser.H │ │ │ │ ├── Fl_Shared_Image.H │ │ │ │ ├── Fl_Shortcut_Button.H │ │ │ │ ├── Fl_Simple_Counter.H │ │ │ │ ├── Fl_Single_Window.H │ │ │ │ ├── Fl_Slider.H │ │ │ │ ├── Fl_Spinner.H │ │ │ │ ├── Fl_Sys_Menu_Bar.H │ │ │ │ ├── Fl_Table.H │ │ │ │ ├── Fl_Table_Row.H │ │ │ │ ├── Fl_Tabs.H │ │ │ │ ├── Fl_Terminal.H │ │ │ │ ├── Fl_Text_Buffer.H │ │ │ │ ├── Fl_Text_Display.H │ │ │ │ ├── Fl_Text_Editor.H │ │ │ │ ├── Fl_Tile.H │ │ │ │ ├── Fl_Tiled_Image.H │ │ │ │ ├── Fl_Timer.H │ │ │ │ ├── Fl_Toggle_Button.H │ │ │ │ ├── Fl_Toggle_Light_Button.H │ │ │ │ ├── Fl_Toggle_Round_Button.H │ │ │ │ ├── Fl_Tooltip.H │ │ │ │ ├── Fl_Tree.H │ │ │ │ ├── Fl_Tree_Item.H │ │ │ │ ├── Fl_Tree_Item_Array.H │ │ │ │ ├── Fl_Tree_Prefs.H │ │ │ │ ├── Fl_Valuator.H │ │ │ │ ├── Fl_Value_Input.H │ │ │ │ ├── Fl_Value_Output.H │ │ │ │ ├── Fl_Value_Slider.H │ │ │ │ ├── Fl_Widget.H │ │ │ │ ├── Fl_Widget_Surface.H │ │ │ │ ├── Fl_Window.H │ │ │ │ ├── Fl_Wizard.H │ │ │ │ ├── Fl_XBM_Image.H │ │ │ │ ├── Fl_XPM_Image.H │ │ │ │ ├── Makefile.in │ │ │ │ ├── README.Xcode │ │ │ │ ├── filename.H │ │ │ │ ├── fl_ask.H │ │ │ │ ├── fl_attr.h │ │ │ │ ├── fl_callback_macros.H │ │ │ │ ├── fl_casts.H │ │ │ │ ├── fl_config.h │ │ │ │ ├── fl_draw.H │ │ │ │ ├── fl_message.H │ │ │ │ ├── fl_show_colormap.H │ │ │ │ ├── fl_show_input.H │ │ │ │ ├── fl_string_functions.h │ │ │ │ ├── fl_types.h │ │ │ │ ├── fl_utf8.h │ │ │ │ ├── forms.H │ │ │ │ ├── gl.h │ │ │ │ ├── gl2opengl.h │ │ │ │ ├── gl_draw.H │ │ │ │ ├── glu.h │ │ │ │ ├── glut.H │ │ │ │ ├── mac.H │ │ │ │ ├── math.h │ │ │ │ ├── names.h │ │ │ │ ├── platform.H │ │ │ │ ├── platform_types.h │ │ │ │ ├── wayland.H │ │ │ │ ├── win32.H │ │ │ │ ├── x.H │ │ │ │ └── x11.H │ │ │ ├── FLTKUtils.h │ │ │ ├── Il2CppBase.h │ │ │ ├── MinHook.h │ │ │ ├── MonoBase.h │ │ │ ├── MonoBridge.cpp │ │ │ ├── MonoBridge.def │ │ │ ├── TrainerBase.h │ │ │ ├── il2cpp/ │ │ │ │ ├── hook.h │ │ │ │ ├── il2cpp.cpp │ │ │ │ ├── il2cpp.h │ │ │ │ ├── il2cpp_api.h │ │ │ │ ├── il2cpp_types.h │ │ │ │ ├── memory.h │ │ │ │ ├── unity.cpp │ │ │ │ ├── unity.h │ │ │ │ └── vec.h │ │ │ └── nlohmann/ │ │ │ ├── adl_serializer.hpp │ │ │ ├── byte_container_with_subtype.hpp │ │ │ ├── detail/ │ │ │ │ ├── abi_macros.hpp │ │ │ │ ├── conversions/ │ │ │ │ │ ├── from_json.hpp │ │ │ │ │ ├── to_chars.hpp │ │ │ │ │ └── to_json.hpp │ │ │ │ ├── exceptions.hpp │ │ │ │ ├── hash.hpp │ │ │ │ ├── input/ │ │ │ │ │ ├── binary_reader.hpp │ │ │ │ │ ├── input_adapters.hpp │ │ │ │ │ ├── json_sax.hpp │ │ │ │ │ ├── lexer.hpp │ │ │ │ │ ├── parser.hpp │ │ │ │ │ └── position_t.hpp │ │ │ │ ├── iterators/ │ │ │ │ │ ├── internal_iterator.hpp │ │ │ │ │ ├── iter_impl.hpp │ │ │ │ │ ├── iteration_proxy.hpp │ │ │ │ │ ├── iterator_traits.hpp │ │ │ │ │ ├── json_reverse_iterator.hpp │ │ │ │ │ └── primitive_iterator.hpp │ │ │ │ ├── json_custom_base_class.hpp │ │ │ │ ├── json_pointer.hpp │ │ │ │ ├── json_ref.hpp │ │ │ │ ├── macro_scope.hpp │ │ │ │ ├── macro_unscope.hpp │ │ │ │ ├── meta/ │ │ │ │ │ ├── call_std/ │ │ │ │ │ │ ├── begin.hpp │ │ │ │ │ │ └── end.hpp │ │ │ │ │ ├── cpp_future.hpp │ │ │ │ │ ├── detected.hpp │ │ │ │ │ ├── identity_tag.hpp │ │ │ │ │ ├── is_sax.hpp │ │ │ │ │ ├── std_fs.hpp │ │ │ │ │ ├── type_traits.hpp │ │ │ │ │ └── void_t.hpp │ │ │ │ ├── output/ │ │ │ │ │ ├── binary_writer.hpp │ │ │ │ │ ├── output_adapters.hpp │ │ │ │ │ └── serializer.hpp │ │ │ │ ├── string_concat.hpp │ │ │ │ ├── string_escape.hpp │ │ │ │ ├── string_utils.hpp │ │ │ │ └── value_t.hpp │ │ │ ├── json.hpp │ │ │ ├── json_fwd.hpp │ │ │ ├── ordered_map.hpp │ │ │ └── thirdparty/ │ │ │ └── hedley/ │ │ │ ├── hedley.hpp │ │ │ └── hedley_undef.hpp │ │ └── libs/ │ │ ├── x64/ │ │ │ ├── fltk.lib │ │ │ ├── fltk_forms.lib │ │ │ ├── fltk_gl.lib │ │ │ ├── fltk_images.lib │ │ │ ├── fltk_jpeg.lib │ │ │ ├── fltk_png.lib │ │ │ ├── fltk_z.lib │ │ │ └── libMinHook.x64.lib │ │ └── x86/ │ │ ├── fltk.lib │ │ ├── fltk_forms.lib │ │ ├── fltk_gl.lib │ │ ├── fltk_images.lib │ │ ├── fltk_jpeg.lib │ │ ├── fltk_png.lib │ │ ├── fltk_z.lib │ │ └── libMinHook.x86.lib │ ├── documents/ │ │ └── trainer_template.h │ ├── scripts/ │ │ ├── font_processor.py │ │ ├── gcm_trainers.json │ │ └── requirements.txt │ └── trainers/ │ ├── Arrow a Row Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── DREDGE Trainer/ │ │ ├── CMakeLists.txt │ │ ├── GCMInjection.cs │ │ ├── GCMInjection.csproj │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ ├── translation_extra.txt │ │ └── translations.json │ ├── Feeding Frenzy 2_Shipwreck Showdown Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Headbangers_Rhythm Royale Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Heavy Weapon Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Inotia 4 Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Just Shapes & Beats Trainer/ │ │ ├── CMakeLists.txt │ │ ├── IL2CPP.cpp │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Oil Rush Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Outland Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Plants vs. Zombies_GOTY Edition Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ ├── Plants vs. Zombies_Replanted Trainer/ │ │ ├── CMakeLists.txt │ │ ├── IL2CPP.cpp │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ ├── translation_extra.txt │ │ └── translations.json │ ├── PvZ2 Gardendless Trainer/ │ │ ├── CMakeLists.txt │ │ ├── main.cpp │ │ ├── resources.rc │ │ ├── trainer.h │ │ └── translations.json │ └── Wizard of Legend 2 Trainer/ │ ├── CMakeLists.txt │ ├── main.cpp │ ├── resources.rc │ ├── trainer.h │ └── translations.json ├── LICENSE.txt ├── README.md ├── README_CN.md ├── README_TW.md ├── requirements.txt └── src/ ├── dependency/ │ ├── CE Translations/ │ │ └── zh_CN/ │ │ ├── Java.po │ │ ├── SaveSessions.po │ │ ├── Tutorial-x86_64.po │ │ ├── VersionCheck.po │ │ ├── cheatengine-x86_64.po │ │ ├── lclstrconsts.po │ │ ├── monoscript.po │ │ ├── patchscan.po │ │ └── pseudocodediagram.po │ └── TrainerBGM.mid ├── locale/ │ ├── de_DE/ │ │ └── LC_MESSAGES/ │ │ └── Game Cheats Manager.po │ ├── en_US/ │ │ └── LC_MESSAGES/ │ │ └── Game Cheats Manager.po │ ├── zh_CN/ │ │ └── LC_MESSAGES/ │ │ └── Game Cheats Manager.po │ └── zh_TW/ │ └── LC_MESSAGES/ │ └── Game Cheats Manager.po └── scripts/ ├── config.py ├── main.py ├── style_sheet.py ├── threads/ │ ├── download_base_thread.py │ ├── download_display_thread.py │ ├── download_trainers_thread.py │ ├── other_threads.py │ └── update_trainers_thread.py └── widgets/ ├── custom_dialogs.py ├── custom_widgets.py └── trainer_management.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/Release to server.yml ================================================ name: Release to Server on: release: types: [published] jobs: deploy-installer: runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - name: Checkout repository uses: actions/checkout@v4 - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME }} aws-region: ${{ secrets.AWS_REGION }} - name: Get release version and installer name id: get_version run: | VERSION=$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') echo "version=$VERSION" >> $GITHUB_OUTPUT echo "local_installer_name=Game.Cheats.Manager.Setup.$VERSION.exe" >> $GITHUB_OUTPUT echo "server_installer_name=Game Cheats Manager Setup $VERSION.exe" >> $GITHUB_OUTPUT - name: Download release asset env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release download ${{ github.event.release.tag_name }} --pattern "${{ steps.get_version.outputs.local_installer_name }}" - name: Delete previous stable installers from S3 env: S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} S3_GCM_PREFIX: "GCM" run: | aws s3 rm "s3://${S3_BUCKET_NAME}/${S3_GCM_PREFIX}/" \ --recursive \ --exclude "*" \ --include "Game Cheats Manager Setup*.exe" \ --exclude "*beta*" echo "Previous stable installers deleted from s3://${S3_BUCKET_NAME}/${S3_GCM_PREFIX}/" - name: Upload new installer to AWS S3 env: S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} S3_GCM_PREFIX: "GCM" run: | LOCAL_INSTALLER_NAME="${{ steps.get_version.outputs.local_installer_name }}" SERVER_INSTALLER_NAME="${{ steps.get_version.outputs.server_installer_name }}" aws s3 cp "./${LOCAL_INSTALLER_NAME}" "s3://${S3_BUCKET_NAME}/${S3_GCM_PREFIX}/${SERVER_INSTALLER_NAME}" echo "'${LOCAL_INSTALLER_NAME}' uploaded to s3://${S3_BUCKET_NAME}/${S3_GCM_PREFIX}/" - name: Create CloudFront Invalidation env: CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} S3_PREFIX_FOR_INVALIDATION: "GCM" run: | echo "Creating invalidation for path /${S3_PREFIX_FOR_INVALIDATION}/*" aws cloudfront create-invalidation \ --distribution-id $CLOUDFRONT_DISTRIBUTION_ID \ --paths "/${S3_PREFIX_FOR_INVALIDATION}/*" ================================================ FILE: .gitignore ================================================ __pycache__ secret_config.py .venv .vscode .DS_Store *.mo dist/ compile.ps1 utility.py ResourceHacker.ini elevate.manifest cpp/ ================================================ FILE: Game Trainers/.gitignore ================================================ build/ .vscode/ bin/ obj/ .venv/ *.sln *.ps1 MonoBridge.dll GCMInjection.dll IL2CPP.dll trainers/**/*.ttf process_user_trainers.py user_trainers.json user_trainers.xlsx completed_trainers.txt User Trainers/ documents/*.txt documents/*.md ================================================ FILE: Game Trainers/CMakeLists.txt ================================================ cmake_minimum_required(VERSION 3.15) project(GameTrainers LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") # Trainer architecture requirements (format: "TrainerName:architecture") # Used by both CMakeLists.txt and build_all.ps1 (which parses this file) set(TRAINER_ARCHITECTURES "Arrow a Row Trainer:x64" "DREDGE Trainer:x86" "Feeding Frenzy 2_Shipwreck Showdown Trainer:x86" "Headbangers_Rhythm Royale Trainer:x64" "Heavy Weapon Trainer:x86" "Inotia 4 Trainer:x64" "Just Shapes & Beats Trainer:x64" "Oil Rush Trainer:x86" "Outland Trainer:x86" "Plants vs. Zombies_GOTY Edition Trainer:x86" "Plants vs. Zombies_Replanted Trainer:x64" "PvZ2 Gardendless Trainer:x64" "Wizard of Legend 2 Trainer:x64" ) add_subdirectory(common) # Determine current platform if(CMAKE_GENERATOR_PLATFORM STREQUAL "x64" OR CMAKE_SIZEOF_VOID_P EQUAL 8) set(CURRENT_PLATFORM "x64") else() set(CURRENT_PLATFORM "x86") endif() message(STATUS "Building for platform: ${CURRENT_PLATFORM}") # Add each game-specific trainer with architecture information foreach(TRAINER_SPEC ${TRAINER_ARCHITECTURES}) string(REPLACE ":" ";" TRAINER_PARTS ${TRAINER_SPEC}) list(GET TRAINER_PARTS 0 TRAINER_NAME) list(GET TRAINER_PARTS 1 TRAINER_ARCH) set(TRAINER_DIR "trainers/${TRAINER_NAME}") set(TRAINER_REQUIRED_ARCH ${TRAINER_ARCH}) # Only add trainers matching the current platform if(TRAINER_ARCH STREQUAL CURRENT_PLATFORM) message(STATUS "Adding: ${TRAINER_NAME} (${TRAINER_ARCH})") add_subdirectory(${TRAINER_DIR}) else() message(STATUS "Skipping: ${TRAINER_NAME} (requires ${TRAINER_ARCH}, building for ${CURRENT_PLATFORM})") endif() endforeach() ================================================ FILE: Game Trainers/common/CMakeLists.txt ================================================ add_library(Common INTERFACE) # Set include directories for Common target_include_directories(Common INTERFACE $ $ ) # Define FLTK library directory based on architecture if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64-bit architecture set(FLTK_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/x64") set(FLTK_LIBS "${FLTK_LIB_DIR}/fltk.lib" "${FLTK_LIB_DIR}/fltk_forms.lib" "${FLTK_LIB_DIR}/fltk_images.lib" "${FLTK_LIB_DIR}/fltk_png.lib" "${FLTK_LIB_DIR}/fltk_z.lib" ) set(MONO_BRIDGE_DEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/x64") set(MINHOOK_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libs/x64/libMinHook.x64.lib") else() # 32-bit architecture set(FLTK_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/x86") set(FLTK_LIBS "${FLTK_LIB_DIR}/fltk.lib" "${FLTK_LIB_DIR}/fltk_forms.lib" "${FLTK_LIB_DIR}/fltk_images.lib" "${FLTK_LIB_DIR}/fltk_png.lib" "${FLTK_LIB_DIR}/fltk_z.lib" ) set(MONO_BRIDGE_DEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/x86") set(MINHOOK_LIB "${CMAKE_CURRENT_SOURCE_DIR}/libs/x86/libMinHook.x86.lib") endif() # Link FLTK and Windows libraries to Common target_link_libraries(Common INTERFACE ${FLTK_LIBS} comctl32 gdiplus ws2_32 shlwapi ) # Define MonoBridge as a shared library add_library(MonoBridge SHARED "${CMAKE_CURRENT_SOURCE_DIR}/include/MonoBridge.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/MonoBridge.def" ) # Link MonoBridge to Common target_link_libraries(MonoBridge PRIVATE Common) # Post-build command to move only MonoBridge.dll to the destination add_custom_command(TARGET MonoBridge POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "${MONO_BRIDGE_DEST_DIR}/MonoBridge.dll" COMMENT "Moving MonoBridge.dll to ${MONO_BRIDGE_DEST_DIR}" ) ================================================ FILE: Game Trainers/common/assets/elevate.xml ================================================ ================================================ FILE: Game Trainers/common/include/CDPBase.h ================================================ // CDPBase.h // Base class for trainers targeting web-based desktop games (Tauri/WebView2, Electron, CEF, NW.js). // Communicates via Chrome DevTools Protocol (CDP) over a persistent WebSocket connection. // Derived classes implement game-specific cheat functions using executeJS(). #pragma once #include #include #include #include #include #include #include #include #include #include #include #pragma comment(lib, "winhttp.lib") using json = nlohmann::json; /// How the game process receives the remote debugging port argument. enum class CDPLaunchMethod { /// WebView2 / Tauri: set env var WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS WebView2EnvVar, /// Electron / CEF / NW.js: append --remote-debugging-port=PORT to command line CommandLineArg }; class CDPBase { public: std::string gamePath; CDPBase(const std::string &settingsKey, CDPLaunchMethod method = CDPLaunchMethod::WebView2EnvVar) : settingsKey_(settingsKey), launchMethod_(method) { loadSettings(); } virtual ~CDPBase() { wsDisconnect(); } // ============================================================ // FLTKUtils compatibility interface // ============================================================ std::wstring getProcessName() const { return L"localhost:" + std::to_wstring(cdpPort_); } DWORD getProcessId() const { return lastCheckResult_ ? (DWORD)cdpPort_ : 0; } void cleanUp() { lastCheckResult_ = false; } /// Called periodically by FLTKUtils timer (~1s). bool isProcessRunning() { if (!gameLaunched_) return false; auto now = std::chrono::steady_clock::now(); auto elapsed = std::chrono::duration_cast(now - lastCheckTime_).count(); if (elapsed < 3000) return lastCheckResult_; lastCheckTime_ = now; if (wsHandle_) { std::string pingResult; lastCheckResult_ = wsEvaluate(cachedWsPath_, "1", &pingResult); } else { // WebSocket is down — quick HTTP check first (fast fail if game is gone) if (!checkCDP()) { lastCheckResult_ = false; } else { // Game is still alive — try to reconnect WebSocket if (cachedWsPath_.empty()) discoverPageWsPath(cachedWsPath_); if (!cachedWsPath_.empty()) lastCheckResult_ = wsReconnect(cachedWsPath_); else lastCheckResult_ = true; // CDP alive, just can't get WS yet } } if (!lastCheckResult_) { cdpFailCount_++; if (cdpFailCount_ >= 3) { wsDisconnect(); cachedWsPath_.clear(); gameLaunched_ = false; cdpFailCount_ = 0; } } else { cdpFailCount_ = 0; } return lastCheckResult_; } // ============================================================ // Game Launching // ============================================================ bool launchGame() { if (gamePath.empty()) return false; cdpPort_ = findFreePort(9222); std::string workDir = gamePath; size_t lastSlash = workDir.find_last_of("\\/"); if (lastSlash != std::string::npos) workDir = workDir.substr(0, lastSlash); STARTUPINFOA si = {}; PROCESS_INFORMATION pi = {}; si.cb = sizeof(si); bool ok = false; if (launchMethod_ == CDPLaunchMethod::WebView2EnvVar) { std::string envVal = "--remote-debugging-port=" + std::to_string(cdpPort_); SetEnvironmentVariableA("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", envVal.c_str()); ok = CreateProcessA( gamePath.c_str(), nullptr, nullptr, nullptr, FALSE, CREATE_NEW_PROCESS_GROUP, nullptr, workDir.c_str(), &si, &pi); } else // CDPLaunchMethod::CommandLineArg { std::string cmdLine = "\"" + gamePath + "\" --remote-debugging-port=" + std::to_string(cdpPort_); ok = CreateProcessA( nullptr, cmdLine.data(), nullptr, nullptr, FALSE, CREATE_NEW_PROCESS_GROUP, nullptr, workDir.c_str(), &si, &pi); } if (ok) { CloseHandle(pi.hProcess); CloseHandle(pi.hThread); gameLaunched_ = true; saveSettings(); } return ok; } // ============================================================ // Core JS Execution via CDP // ============================================================ /// Execute JavaScript in the game's web context via CDP. /// @param expression JS code to evaluate (should return 'ok' on success) /// @param result Optional: receives the return value as string /// @return true if JS executed and did NOT return a 'fail' string bool executeJS(const std::string &expression, std::string *result = nullptr) { std::string safeExpr = "try{" + expression + "}catch(_e){'fail: '+_e.message}"; if (cachedWsPath_.empty()) { if (!discoverPageWsPath(cachedWsPath_)) { std::cerr << "[!] Failed to discover CDP page target.\n"; return false; } } std::string jsResult; bool connected = wsEvaluate(cachedWsPath_, safeExpr, &jsResult); if (!connected) { wsDisconnect(); cachedWsPath_.clear(); if (discoverPageWsPath(cachedWsPath_)) connected = wsEvaluate(cachedWsPath_, safeExpr, &jsResult); if (!connected) return false; } if (result) *result = jsResult; if (jsResult.size() >= 4 && jsResult.compare(0, 4, "fail") == 0) return false; return true; } // ============================================================ // Settings Persistence // ============================================================ void saveSettings() { std::string path = getSettingsFilePath(); json settings; std::ifstream ifile(path); if (ifile.is_open()) { try { ifile >> settings; } catch (...) { } ifile.close(); } else { std::filesystem::create_directories(std::filesystem::path(path).parent_path()); } settings["game_path"] = gamePath; std::ofstream ofile(path); ofile << settings.dump(4); } void loadSettings() { std::string path = getSettingsFilePath(); std::ifstream file(path); if (!file.is_open()) return; try { json settings; file >> settings; if (settings.contains("game_path")) gamePath = settings["game_path"].get(); } catch (...) { } } private: std::string settingsKey_; CDPLaunchMethod launchMethod_; int cdpPort_ = 9222; bool gameLaunched_ = false; bool lastCheckResult_ = false; int cdpFailCount_ = 0; std::string cachedWsPath_; std::chrono::steady_clock::time_point lastCheckTime_; // Persistent WebSocket connection handles HINTERNET wsSession_ = nullptr; HINTERNET wsConnect_ = nullptr; HINTERNET wsHandle_ = nullptr; int nextMsgId_ = 1; std::string getSettingsFilePath() { PWSTR appdata = nullptr; SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &appdata); std::filesystem::path dir(appdata); CoTaskMemFree(appdata); return (dir / "GCM Settings" / (settingsKey_ + ".json")).string(); } int findFreePort(int startPort) { for (int port = startPort; port < startPort + 100; ++port) { SOCKET sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (sock == INVALID_SOCKET) continue; sockaddr_in addr = {}; addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); addr.sin_port = htons((u_short)port); int result = bind(sock, (sockaddr *)&addr, sizeof(addr)); closesocket(sock); if (result == 0) return port; } return startPort; } // ============================================================ // CDP HTTP / WebSocket Implementation // ============================================================ bool checkCDP() { HINTERNET hSession = WinHttpOpen(L"CDPTrainer", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); if (!hSession) return false; DWORD connectTimeout = 200; DWORD ioTimeout = 300; WinHttpSetOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &connectTimeout, sizeof(connectTimeout)); WinHttpSetOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &ioTimeout, sizeof(ioTimeout)); WinHttpSetOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &ioTimeout, sizeof(ioTimeout)); HINTERNET hConnect = WinHttpConnect(hSession, L"localhost", (INTERNET_PORT)cdpPort_, 0); if (!hConnect) { WinHttpCloseHandle(hSession); return false; } HINTERNET hRequest = WinHttpOpenRequest(hConnect, L"GET", L"/json/version", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); if (!hRequest) { WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hSession); return false; } bool ok = false; if (WinHttpSendRequest(hRequest, NULL, 0, NULL, 0, 0, 0) && WinHttpReceiveResponse(hRequest, NULL)) { DWORD statusCode = 0; DWORD sz = sizeof(statusCode); WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &statusCode, &sz, NULL); ok = (statusCode == 200); } WinHttpCloseHandle(hRequest); WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hSession); return ok; } std::string httpGet(const wchar_t *path) { HINTERNET hSession = WinHttpOpen(L"CDPTrainer", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); if (!hSession) return ""; DWORD timeout = 500; WinHttpSetOption(hSession, WINHTTP_OPTION_CONNECT_TIMEOUT, &timeout, sizeof(timeout)); WinHttpSetOption(hSession, WINHTTP_OPTION_RECEIVE_TIMEOUT, &timeout, sizeof(timeout)); WinHttpSetOption(hSession, WINHTTP_OPTION_SEND_TIMEOUT, &timeout, sizeof(timeout)); HINTERNET hConnect = WinHttpConnect(hSession, L"localhost", (INTERNET_PORT)cdpPort_, 0); if (!hConnect) { WinHttpCloseHandle(hSession); return ""; } HINTERNET hRequest = WinHttpOpenRequest(hConnect, L"GET", path, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); if (!hRequest) { WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hSession); return ""; } std::string body; if (WinHttpSendRequest(hRequest, NULL, 0, NULL, 0, 0, 0) && WinHttpReceiveResponse(hRequest, NULL)) { DWORD avail = 0; while (WinHttpQueryDataAvailable(hRequest, &avail) && avail > 0) { std::vector buf(avail); DWORD bytesRead = 0; WinHttpReadData(hRequest, buf.data(), avail, &bytesRead); body.append(buf.data(), bytesRead); } } WinHttpCloseHandle(hRequest); WinHttpCloseHandle(hConnect); WinHttpCloseHandle(hSession); return body; } bool discoverPageWsPath(std::string &outPath) { std::string body = httpGet(L"/json"); if (body.empty()) return false; json targets = json::parse(body, nullptr, false); if (targets.is_discarded() || !targets.is_array()) return false; for (auto &target : targets) { if (target.value("type", "") == "page") { std::string wsUrl = target.value("webSocketDebuggerUrl", ""); if (wsUrl.empty()) continue; size_t pathStart = wsUrl.find('/', wsUrl.find("//") + 2); if (pathStart != std::string::npos) { outPath = wsUrl.substr(pathStart); return true; } } } return false; } bool wsEvaluate(const std::string &wsPath, const std::string &expression, std::string *result) { if (!wsHandle_ && !wsReconnect(wsPath)) return false; int msgId = nextMsgId_++; json msg = { {"id", msgId}, {"method", "Runtime.evaluate"}, {"params", {{"expression", expression}, {"returnByValue", true}, {"awaitPromise", false}}}}; std::string msgStr = msg.dump(); DWORD err = WinHttpWebSocketSend(wsHandle_, WINHTTP_WEB_SOCKET_UTF8_MESSAGE_BUFFER_TYPE, (PVOID)msgStr.c_str(), (DWORD)msgStr.size()); if (err != ERROR_SUCCESS) { wsDisconnect(); return false; } for (int attempts = 0; attempts < 50; attempts++) { std::string response = wsReadMessage(wsHandle_); if (response.empty()) { wsDisconnect(); return false; } json resp = json::parse(response, nullptr, false); if (resp.is_discarded()) continue; if (resp.contains("id") && resp["id"].get() == msgId) { if (result && resp.contains("result") && resp["result"].contains("result")) { auto &val = resp["result"]["result"]; if (val.contains("value")) { if (val["value"].is_string()) *result = val["value"].get(); else *result = val["value"].dump(); } } return true; } } wsDisconnect(); return false; } bool wsReconnect(const std::string &wsPath) { wsDisconnect(); wsSession_ = WinHttpOpen(L"CDPTrainer", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); if (!wsSession_) return false; DWORD connectTimeout = 500; DWORD sendRecvTimeout = 3000; WinHttpSetOption(wsSession_, WINHTTP_OPTION_CONNECT_TIMEOUT, &connectTimeout, sizeof(connectTimeout)); WinHttpSetOption(wsSession_, WINHTTP_OPTION_RECEIVE_TIMEOUT, &sendRecvTimeout, sizeof(sendRecvTimeout)); WinHttpSetOption(wsSession_, WINHTTP_OPTION_SEND_TIMEOUT, &sendRecvTimeout, sizeof(sendRecvTimeout)); wsConnect_ = WinHttpConnect(wsSession_, L"localhost", (INTERNET_PORT)cdpPort_, 0); if (!wsConnect_) { wsDisconnect(); return false; } std::wstring wPath(wsPath.begin(), wsPath.end()); HINTERNET hRequest = WinHttpOpenRequest(wsConnect_, L"GET", wPath.c_str(), NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); if (!hRequest) { wsDisconnect(); return false; } WinHttpSetOption(hRequest, WINHTTP_OPTION_UPGRADE_TO_WEB_SOCKET, NULL, 0); if (!WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, NULL, 0, 0, 0) || !WinHttpReceiveResponse(hRequest, NULL)) { WinHttpCloseHandle(hRequest); wsDisconnect(); return false; } wsHandle_ = WinHttpWebSocketCompleteUpgrade(hRequest, 0); WinHttpCloseHandle(hRequest); if (!wsHandle_) { wsDisconnect(); return false; } return true; } void wsDisconnect() { if (wsHandle_) { WinHttpCloseHandle(wsHandle_); wsHandle_ = nullptr; } if (wsConnect_) { WinHttpCloseHandle(wsConnect_); wsConnect_ = nullptr; } if (wsSession_) { WinHttpCloseHandle(wsSession_); wsSession_ = nullptr; } } std::string wsReadMessage(HINTERNET hWs) { std::string message; char buffer[8192]; DWORD bytesRead = 0; WINHTTP_WEB_SOCKET_BUFFER_TYPE bufferType; do { DWORD err = WinHttpWebSocketReceive(hWs, buffer, sizeof(buffer), &bytesRead, &bufferType); if (err != ERROR_SUCCESS) return ""; if (bufferType == WINHTTP_WEB_SOCKET_CLOSE_BUFFER_TYPE) return ""; message.append(buffer, bytesRead); } while (bufferType == WINHTTP_WEB_SOCKET_UTF8_FRAGMENT_BUFFER_TYPE || bufferType == WINHTTP_WEB_SOCKET_BINARY_FRAGMENT_BUFFER_TYPE); return message; } }; ================================================ FILE: Game Trainers/common/include/FL/Enumerations.H ================================================ // // Enumerations for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file This file contains type definitions and general enumerations. */ #ifndef Fl_Enumerations_H #define Fl_Enumerations_H /* ****************************************************************************** * FL_ABI_VERSION is defined by configure or CMake since FLTK 1.3.4. * It is written to FL/fl_config.h and #included here. ****************************************************************************** * For more informations on FL_ABI_VERSION see README.abi-version.txt. ****************************************************************************** */ #include # include "Fl_Export.H" # include "fl_types.h" # include // for FL_COMMAND and FL_CONTROL // Current FLTK version: 1.4.2 /** \name Version Numbers FLTK defines some constants to help the programmer to find out, for which FLTK version a program is compiled. The following constants are defined: */ /**@{*/ /** The major release version of this FLTK library. \see FL_VERSION */ #define FL_MAJOR_VERSION 1 /** The minor release version for this library. FLTK remains mostly source-code compatible between minor version changes. */ #define FL_MINOR_VERSION 4 /** The patch version for this library. FLTK remains binary compatible between patches. */ #define FL_PATCH_VERSION 2 /** The FLTK version number as a \em double. FL_VERSION is a \em double that describes the major, minor, and patch version numbers. Version 1.2.3 is actually stored as 1.0203 to allow for more than 9 minor and patch releases. \deprecated This \p double version number is retained for compatibility with existing program code. New code should use \em int FL_API_VERSION instead. FL_VERSION is deprecated because comparisons of floating point values may fail due to rounding errors. However, there are currently no plans to remove this deprecated constant. FL_VERSION is equivalent to (double)FL_API_VERSION / 10000. \see Fl::version() (deprecated as well) \see FL_API_VERSION \see Fl::api_version() */ #define FL_VERSION ( (double)FL_MAJOR_VERSION + \ (double)FL_MINOR_VERSION * 0.01 + \ (double)FL_PATCH_VERSION * 0.0001 ) /** The FLTK API version number as an \em int. FL_API_VERSION is an \em int that describes the major, minor, and patch version numbers. Version 1.2.3 is actually stored as 10203 to allow for more than 9 minor and patch releases. The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants give the integral values for the major, minor, and patch releases respectively. \note FL_API_VERSION is intended to replace the deprecated \em double FL_VERSION. \see Fl::api_version() */ #define FL_API_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100 + FL_PATCH_VERSION) /** The FLTK ABI (Application Binary Interface) version number as an \em int. FL_ABI_VERSION is an \em int that describes the major, minor, and patch ABI version numbers in the same format as FL_API_VERSION. The ABI version number \p FL_ABI_VERSION is usually the same as the API version \p FL_API_VERSION with the last two digits set to '00'. FLTK retains the ABI (Application Binary Interface) during patch releases of the same major and minor versions. Examples: \verbatim FLTK Version FL_API_VERSION FL_ABI_VERSION FL_VERSION (deprecated) 1.3.0 10300 10300 1.0300 1.3.4 10304 10300 1.0304 \endverbatim Version 1.2.3 is actually stored as 10203 to allow for more than 9 minor and patch releases. The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants give the integral values for the major, minor, and patch releases respectively. To enable new ABI-breaking features in patch releases you can configure FLTK to use a higher FL_ABI_VERSION. \see README.abi-version.txt */ #ifndef FL_ABI_VERSION #define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100) #endif /* Check if FL_ABI_VERSION is out of allowed range; redefine if necessary. This is done to prevent users from defining an illegal ABI version. Rule: FL_MAJOR_VERSION * 10000 + FL_MINOR_VERSION * 100 <= FL_ABI_VERSION <= FL_API_VERSION. Example (FLTK 1.3.4): 10300 <= FL_ABI_VERSION <= 10304 Note: configure + CMake can be used to define FL_ABI_VERSION, but they do not check validity. This is done here. */ #if FL_ABI_VERSION < FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100 # undef FL_ABI_VERSION # define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100) #elif FL_ABI_VERSION > FL_API_VERSION # undef FL_ABI_VERSION # define FL_ABI_VERSION FL_API_VERSION #endif /**@}*/ // group: Version Numbers /** Every time a user moves the mouse pointer, clicks a button, or presses a key, an event is generated and sent to your application. Events can also come from other programs like the window manager. Events are identified by the integer argument passed to the Fl_Widget::handle() virtual method. Other information about the most recent event is stored in static locations and acquired by calling the Fl::event_*() methods. This static information remains valid until the next event is read from the window system, so it is ok to look at it outside of the handle() method. Event numbers can be converted to their actual names using the \ref fl_eventnames[] array defined in \#include <FL/names.h> \see Fl::event_text(), Fl::event_key(), class Fl:: */ // DEV NOTE: Keep this list in sync with FL/names.h enum Fl_Event { // events /** No event. */ FL_NO_EVENT = 0, /** A mouse button has gone down with the mouse pointing at this widget. You can find out what button by calling Fl::event_button(). You find out the mouse position by calling Fl::event_x() and Fl::event_y(). A widget indicates that it "wants" the mouse click by returning non-zero from its Fl_Widget::handle() method. It will then become the Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events. If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH to another widget. */ FL_PUSH = 1, /** A mouse button has been released. You can find out what button by calling Fl::event_button(). In order to receive the FL_RELEASE event, the widget must return non-zero when handling FL_PUSH. */ FL_RELEASE = 2, /** The mouse has been moved to point at this widget. This can be used for highlighting feedback. If a widget wants to highlight or otherwise track the mouse, it indicates this by returning non-zero from its handle() method. It then becomes the Fl::belowmouse() widget and will receive FL_MOVE and FL_LEAVE events. */ FL_ENTER = 3, /** The mouse has moved out of the widget. In order to receive the FL_LEAVE event, the widget must return non-zero when handling FL_ENTER. */ FL_LEAVE = 4, /** The mouse has moved with a button held down. The current button state is in Fl::event_state(). The mouse position is in Fl::event_x() and Fl::event_y(). In order to receive FL_DRAG events, the widget must return non-zero when handling FL_PUSH. */ FL_DRAG = 5, /** This indicates an attempt to give a widget the keyboard focus. If a widget wants the focus, it should change itself to display the fact that it has the focus, and return non-zero from its handle() method. It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP, and FL_UNFOCUS events. The focus will change either because the window manager changed which window gets the focus, or because the user tried to navigate using tab, arrows, or other keys. You can check Fl::event_key() to figure out why it moved. For navigation it will be the key pressed and for interaction with the window manager it will be zero. */ FL_FOCUS = 6, /** This event is sent to the previous Fl::focus() widget when another widget gets the focus or the window loses focus. */ FL_UNFOCUS = 7, /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP). Fl_KEYBOARD is a synonym for FL_KEYDOWN. The key can be found in Fl::event_key(). The text that the key should insert can be found with Fl::event_text() and its length is in Fl::event_length(). If you use the key handle() should return 1. If you return zero then FLTK assumes you ignored the key and will then attempt to send it to a parent widget. If none of them want it, it will change the event into a FL_SHORTCUT event. To receive FL_KEYBOARD events you must also respond to the FL_FOCUS and FL_UNFOCUS events. If you are writing a text-editing widget you may also want to call the Fl::compose() function to translate individual keystrokes into non-ASCII characters. FL_KEYUP events are sent to the widget that currently has focus. This is not necessarily the same widget that received the corresponding FL_KEYDOWN event because focus may have changed between events. */ FL_KEYDOWN = 8, /** Equivalent to FL_KEYDOWN. \see FL_KEYDOWN */ FL_KEYBOARD = 8, /** Key release event. \see FL_KEYDOWN */ FL_KEYUP = 9, /** The user clicked the close button of a window. This event is used internally only to trigger the callback of Fl_Window derived classed. The default callback closes the window calling Fl_Window::hide(). */ FL_CLOSE = 10, /** The mouse has moved without any mouse buttons held down. This event is sent to the Fl::belowmouse() widget. In order to receive FL_MOVE events, the widget must return non-zero when handling FL_ENTER. */ FL_MOVE = 11, /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD event then FLTK tries sending this event to every widget it can, until one of them returns non-zero. FL_SHORTCUT is first sent to the Fl::belowmouse() widget, then its parents and siblings, and eventually to every widget in the window, trying to find an object that returns non-zero. FLTK tries really hard to not to ignore any keystrokes! You can also make "global" shortcuts by using Fl::add_handler(). A global shortcut will work no matter what windows are displayed or which one has the focus. */ FL_SHORTCUT = 12, /** This widget is no longer active, due to Fl_Widget::deactivate() being called on it or one of its parents. Fl_Widget::active() may still be true after this, the widget is only active if Fl_Widget::active() is true on it and all its parents (use Fl_Widget::active_r() to check this). */ FL_DEACTIVATE = 13, /** This widget is now active, due to Fl_Widget::activate() being called on it or one of its parents. */ FL_ACTIVATE = 14, /** This widget is no longer visible, due to Fl_Widget::hide() being called on it or one of its parents, or due to a parent window being minimized. Fl_Widget::visible() may still be true after this, but the widget is visible only if visible() is true for it and all its parents (use Fl_Widget::visible_r() to check this). */ FL_HIDE = 15, /** This widget is visible again, due to Fl_Widget::show() being called on it or one of its parents, or due to a parent window being restored. Child Fl_Windows respond to this by actually creating the window if not done already, so if you subclass a window, be sure to pass FL_SHOW to the base class Fl_Widget::handle() method! */ FL_SHOW = 16, /** You should get this event some time after you call Fl::paste(). The contents of Fl::event_text() is the text to insert and the number of characters is in Fl::event_length(). */ FL_PASTE = 17, /** The Fl::selection_owner() will get this event before the selection is moved to another widget. This indicates that some other widget or program has claimed the selection. Motif programs used this to clear the selection indication. Most modern programs ignore this. */ FL_SELECTIONCLEAR = 18, /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy() methods can be used to find the amount to scroll horizontally and vertically. */ FL_MOUSEWHEEL = 19, /** The mouse has been moved to point at this widget. A widget that is interested in receiving drag'n'drop data must return 1 to receive FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events. */ FL_DND_ENTER = 20, /** The mouse has been moved inside a widget while dragging data. A widget that is interested in receiving drag'n'drop data should indicate the possible drop position. */ FL_DND_DRAG = 21, /** The mouse has moved out of the widget. */ FL_DND_LEAVE = 22, /** The user has released the mouse button dropping data into the widget. If the widget returns 1, it will receive the data in the immediately following FL_PASTE event. */ FL_DND_RELEASE = 23, /** The screen configuration (number, positions) was changed. Use Fl::add_handler() to be notified of this event. */ FL_SCREEN_CONFIGURATION_CHANGED = 24, /** The fullscreen state of the window has changed. This event is sent to the window's handle method. */ FL_FULLSCREEN = 25, /** The user has made a zoom/pinch/magnification gesture (Mac OS platform only). The Fl::event_dy() method can be used to find magnification amount, Fl::event_x() and Fl::event_y() are set as well. This event is sent to the window's handle method. */ FL_ZOOM_GESTURE = 26, /** A zoom event (ctrl/+/-/0/ or cmd/+/-/0/) was processed. Use Fl::add_handler() to be notified of this event. */ FL_ZOOM_EVENT = 27 // DEV NOTE: Keep this list in sync with FL/names.h }; /** \name When Conditions */ /**@{*/ /** These constants determine when a callback is performed. Fl_When is a bit field. Some values are merely shortcuts for common bit combinations. New flags may be added in the future, so it's important to mask the required bit when reading via \p when(). \note Some widgets may not fully support \p FL_WHEN_... flags. \see Fl_Widget::when(), Fl::callback_reason(), Fl_Callback_Reason, Fl_Widget::do_callback() */ enum Fl_When { // Fl_Widget::when(): FL_WHEN_NEVER = 0, ///< Never call the callback FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes FL_WHEN_RELEASE_ALWAYS = 6, ///< Do the callback when the button or key is released, even if the value doesn't change FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes FL_WHEN_ENTER_KEY_ALWAYS = 10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change FL_WHEN_ENTER_KEY_CHANGED = 11, ///< Do callbacks whether the value changed or not, and when the ENTER key is pressed FL_WHEN_CLOSED = 16 ///< Do the callback when a child of Fl_Tabs is closed }; /**@}*/ // group: When Conditions /** \name Callback Reasons */ /**@{*/ /** These constants describe why a callback is performed. \see Fl::callback_reason(), Fl_Widget::when(), Fl_When */ enum Fl_Callback_Reason { FL_REASON_UNKNOWN=0, ///< unknown or unset reason FL_REASON_SELECTED, ///< an item was selected FL_REASON_DESELECTED, ///< an item was de-selected FL_REASON_RESELECTED, ///< an item was re-selected (double-clicked). FL_REASON_OPENED, ///< an item was opened FL_REASON_CLOSED, ///< an item was closed FL_REASON_DRAGGED, ///< an item was dragged into a new place FL_REASON_CANCELLED, ///< a dialog was cancelled FL_REASON_CHANGED, ///< the value of the widget was modified FL_REASON_GOT_FOCUS, ///< a widget received focus FL_REASON_LOST_FOCUS, ///< a widget lost focus FL_REASON_RELEASED, ///< the mouse button was released FL_REASON_ENTER_KEY, ///< user finished input pressing Enter FL_REASON_USER = 32 ///< user defined callback reasons }; /**@}*/ // group: Callback Reasons /** \name Names of Non-ASCII keys and mouse buttons The following constants define the names of non-ASCII keys on the keyboard and of mouse buttons for FL_KEYBOARD and FL_SHORTCUT events. \see Fl::event_key() and Fl::get_key(int) (use ASCII letters for all other keys): */ /**@{*/ // FIXME: These codes collide with valid Unicode keys #define FL_Button 0xfee8 ///< A mouse button; use FL_Button + n for mouse button \c n. #define FL_BackSpace 0xff08 ///< The backspace key. #define FL_Tab 0xff09 ///< The tab key. #define FL_Iso_Key 0xff0c ///< The additional key of ISO keyboards. #define FL_Enter 0xff0d ///< The enter key. #define FL_Pause 0xff13 ///< The pause key. #define FL_Scroll_Lock 0xff14 ///< The scroll lock key. #define FL_Escape 0xff1b ///< The escape key. #define FL_Kana 0xff2e ///< The Kana key of JIS keyboards. #define FL_Eisu 0xff2f ///< The Eisu key of JIS keyboards. #define FL_Yen 0xff30 ///< The Yen key of JIS keyboards. #define FL_JIS_Underscore 0xff31 ///< The underscore key of JIS keyboards. #define FL_Home 0xff50 ///< The home key. #define FL_Left 0xff51 ///< The left arrow key. #define FL_Up 0xff52 ///< The up arrow key. #define FL_Right 0xff53 ///< The right arrow key. #define FL_Down 0xff54 ///< The down arrow key. #define FL_Page_Up 0xff55 ///< The page-up key. #define FL_Page_Down 0xff56 ///< The page-down key. #define FL_End 0xff57 ///< The end key. #define FL_Print 0xff61 ///< The print (or print-screen) key. #define FL_Insert 0xff63 ///< The insert key. #define FL_Menu 0xff67 ///< The menu key. #define FL_Help 0xff68 ///< The 'help' key on Mac keyboards #define FL_Num_Lock 0xff7f ///< The num lock key. #define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + 'n' for digit n. #define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'. #define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad. #define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n. #define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys. #define FL_Shift_L 0xffe1 ///< The lefthand shift key. #define FL_Shift_R 0xffe2 ///< The righthand shift key. #define FL_Control_L 0xffe3 ///< The lefthand control key. #define FL_Control_R 0xffe4 ///< The righthand control key. #define FL_Caps_Lock 0xffe5 ///< The caps lock key. #define FL_Meta_L 0xffe7 ///< The left meta/Windows key. #define FL_Meta_R 0xffe8 ///< The right meta/Windows key. #define FL_Alt_L 0xffe9 ///< The left alt key. #define FL_Alt_R 0xffea ///< The right alt key. #define FL_Delete 0xffff ///< The delete key. #define FL_Alt_Gr 0xfe03 ///< The AltGr key on some international keyboards. // These use the Private Use Area (PUA) of the Basic Multilingual Plane // of Unicode. Guaranteed not to conflict with a proper Unicode character. // These primarily map to the XFree86 keysym range #define FL_Volume_Down 0xEF11 ///< Volume control down #define FL_Volume_Mute 0xEF12 ///< Mute sound from the system #define FL_Volume_Up 0xEF13 ///< Volume control up #define FL_Media_Play 0xEF14 ///< Start playing of audio #define FL_Media_Stop 0xEF15 ///< Stop playing audio #define FL_Media_Prev 0xEF16 ///< Previous track #define FL_Media_Next 0xEF17 ///< Next track #define FL_Home_Page 0xEF18 ///< Display user's home page #define FL_Mail 0xEF19 ///< Invoke user's mail program #define FL_Search 0xEF1B ///< Search #define FL_Back 0xEF26 ///< Like back on a browser #define FL_Forward 0xEF27 ///< Like forward on a browser #define FL_Stop 0xEF28 ///< Stop current operation #define FL_Refresh 0xEF29 ///< Refresh the page #define FL_Sleep 0xEF2F ///< Put system to sleep #define FL_Favorites 0xEF30 ///< Show favorite locations /**@}*/ // group: Non-ASCII key names /** \name Mouse Buttons These constants define the button numbers for FL_PUSH and FL_RELEASE events. \see Fl::event_button() */ /**@{*/ #define FL_LEFT_MOUSE 1 ///< The left mouse button #define FL_MIDDLE_MOUSE 2 ///< The middle mouse button #define FL_RIGHT_MOUSE 3 ///< The right mouse button #define FL_BACK_MOUSE 4 ///< The back mouse button (side button 1) #define FL_FORWARD_MOUSE 5 ///< The forward mouse button (side button 2) /**@}*/ // group: Mouse Buttons /** \name Event States The following constants define bits in the Fl::event_state() value. */ /**@{*/ // group: Event States // FIXME: it would be nice to have the modifiers in the upper 8 bits so that // a unicode key (21 bits) can be sent as an unsigned with the modifiers. #define FL_SHIFT 0x00010000 ///< One of the shift keys is down #define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on #define FL_CTRL 0x00040000 ///< One of the ctrl keys is down #define FL_ALT 0x00080000 ///< One of the alt keys is down #define FL_NUM_LOCK 0x00100000 ///< The num lock is on // most X servers do this? #define FL_META 0x00400000 ///< One of the meta/Windows keys is down // correct for XFree86 #define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on // correct for XFree86 // Mouse buttons #define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed (L) #define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed (M) #define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed (R) #define FL_BUTTON4 0x08000000 ///< Mouse button 4 is pushed (BACK) #define FL_BUTTON5 0x10000000 ///< Mouse button 5 is pushed (FORWARD) #define FL_BUTTONS 0x1f000000 ///< Bitmask: any mouse button (1-5) is pushed #define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n = 1..5) is pushed, ///< *undefined* if n outside 1..5 #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now // FIXME: Unicode needs 21 bits! /**@}*/ // group: Event States /** \name Box Types \brief FLTK standard box types This enum defines the standard box types included with FLTK. \note The documented \p enum \p Fl_Boxtype contains some values (names) with leading underscores, e.g. \p \b _FL_SHADOW_BOX. This is due to technical reasons - please use the same values (names) without the leading underscore in your code! Enum values with leading underscores are reserved for internal use and subject to change without notice! FL_NO_BOX means nothing is drawn at all, so whatever is already on the screen remains. The FL_..._FRAME types only draw their edges, leaving the interior unchanged. The blue color in the image below is the area that is not drawn by the frame types. \anchor boxTypesImage \image html boxtypes.png "FLTK Standard Box Types" \image latex boxtypes.png "FLTK Standard Box Types" width=12cm \note Not all box types are depicted in the figure above. See enum \ref Fl_Boxtype below for the complete list of box types. \see Fl::get_system_colors() */ /**@{*/ // group: Box Types /** \brief FLTK standard box types This enum defines the standard box types included with FLTK. \note The documented \p enum \p Fl_Boxtype contains some values (names) with leading underscores, e.g. \p \b _FL_SHADOW_BOX. This is due to technical reasons - please use the same values (names) without the leading underscore in your code! Enum values with leading underscores are reserved for internal use and subject to change without notice! */ enum Fl_Boxtype { // boxtypes (if you change these you must also change fl_boxtype.cxx): FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible FL_FLAT_BOX, ///< a flat box FL_UP_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_DOWN_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_UP_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_DOWN_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_THIN_UP_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_THIN_DOWN_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_THIN_UP_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_THIN_DOWN_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_ENGRAVED_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_EMBOSSED_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_ENGRAVED_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_EMBOSSED_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) FL_BORDER_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage) _FL_SHADOW_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_SHADOW_BOX FL_BORDER_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage) _FL_SHADOW_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_SHADOW_FRAME _FL_ROUNDED_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_ROUNDED_BOX _FL_RSHADOW_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_RSHADOW_BOX _FL_ROUNDED_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_ROUNDED_FRAME _FL_RFLAT_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_RFLAT_BOX _FL_ROUND_UP_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_ROUND_UP_BOX _FL_ROUND_DOWN_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_ROUND_DOWN_BOX _FL_DIAMOND_UP_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_DIAMOND_UP_BOX _FL_DIAMOND_DOWN_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_DIAMOND_DOWN_BOX _FL_OVAL_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_OVAL_BOX _FL_OSHADOW_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_OSHADOW_BOX _FL_OVAL_FRAME, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_OVAL_FRAME _FL_OFLAT_BOX, ///< see figure [Standard Box Types](@ref boxTypesImage), use FL_OFLAT_BOX _FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX, use FL_PLASTIC_UP_BOX _FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX, use FL_PLASTIC_DOWN_BOX _FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME, use FL_PLASTIC_UP_FRAME _FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME, use FL_PLASTIC_DOWN_FRAME _FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX, use FL_PLASTIC_THIN_UP_BOX _FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX, use FL_PLASTIC_THIN_DOWN_BOX _FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX, use FL_PLASTIC_ROUND_UP_BOX _FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX, use FL_PLASTIC_ROUND_DOWN_BOX _FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX, use FL_GTK_UP_BOX _FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX, use FL_GTK_DOWN_BOX _FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME, use FL_GTK_UP_FRAME _FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_FRAME, use FL_GTK_DOWN_FRAME _FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX, use FL_GTK_THIN_UP_BOX _FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX, use FL_GTK_THIN_DOWN_BOX _FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_THIN_UP_FRAME, use FL_GTK_THIN_UP_FRAME _FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME, use FL_GTK_THIN_DOWN_FRAME _FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX, use FL_GTK_ROUND_UP_BOX _FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX, use FL_GTK_ROUND_DOWN_BOX _FL_GLEAM_UP_BOX, ///< gleam version of FL_UP_BOX, use FL_GLEAM_UP_BOX _FL_GLEAM_DOWN_BOX, ///< gleam version of FL_DOWN_BOX, use FL_GLEAM_DOWN_BOX _FL_GLEAM_UP_FRAME, ///< gleam version of FL_UP_FRAME, use FL_GLEAM_UP_FRAME _FL_GLEAM_DOWN_FRAME, ///< gleam version of FL_DOWN_FRAME, use FL_GLEAM_DOWN_FRAME _FL_GLEAM_THIN_UP_BOX, ///< gleam version of FL_THIN_UP_BOX, use FL_GLEAM_THIN_UP_BOX _FL_GLEAM_THIN_DOWN_BOX, ///< gleam version of FL_THIN_DOWN_BOX, use FL_GLEAM_THIN_DOWN_BOX _FL_GLEAM_ROUND_UP_BOX, ///< gleam version of FL_ROUND_UP_BOX, use FL_GLEAM_ROUND_UP_BOX _FL_GLEAM_ROUND_DOWN_BOX, ///< gleam version of FL_ROUND_DOWN_BOX, use FL_GLEAM_ROUND_DOWN_BOX _FL_OXY_UP_BOX, ///< oxy version of FL_UP_BOX, use FL_OXY_UP_BOX _FL_OXY_DOWN_BOX, ///< oxy version of FL_DOWN_BOX, use FL_OXY_DOWN_BOX _FL_OXY_UP_FRAME, ///< oxy version of FL_UP_FRAME, use FL_OXY_UP_FRAME _FL_OXY_DOWN_FRAME, ///< oxy version of FL_DOWN_FRAME, use FL_OXY_DOWN_FRAME _FL_OXY_THIN_UP_BOX, ///< oxy version of FL_THIN_UP_BOX, use FL_OXY_THIN_UP_BOX _FL_OXY_THIN_DOWN_BOX, ///< oxy version of FL_THIN_DOWN_BOX, use FL_OXY_THIN_DOWN_BOX _FL_OXY_THIN_UP_FRAME, ///< oxy version of FL_THIN_UP_FRAME, use FL_OXY_THIN_UP_FRAME _FL_OXY_THIN_DOWN_FRAME, ///< oxy version of FL_THIN_DOWN_FRAME, use FL_OXY_THIN_DOWN_FRAME _FL_OXY_ROUND_UP_BOX, ///< oxy version of FL_ROUND_UP_BOX, use FL_OXY_ROUND_UP_BOX _FL_OXY_ROUND_DOWN_BOX, ///< oxy version of FL_ROUND_DOWN_BOX, use FL_OXY_ROUND_DOWN_BOX _FL_OXY_BUTTON_UP_BOX, ///< FL_OXY_BUTTON_UP_BOX (new boxtype ?), use FL_OXY_BUTTON_UP_BOX _FL_OXY_BUTTON_DOWN_BOX, ///< FL_OXY_BUTTON_DOWN_BOX (new boxtype ?), use FL_OXY_BUTTON_DOWN_BOX FL_FREE_BOXTYPE, ///< the first free box type for creation of new box types FL_MAX_BOXTYPE = 255 ///< highest legal index for a box type }; #ifndef FL_DOXYGEN extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX(); #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX() #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1) extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX(); #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX() #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2) extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX(); #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX() #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2) extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX(); #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX() extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX(); #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX() extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX(); #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX() #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1) extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX(); #define FL_OVAL_BOX fl_define_FL_OVAL_BOX() #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1) #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX(); #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX() #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1) #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2) #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3) #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4) #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5) #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6) #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7) extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX(); #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX() #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1) #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2) #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3) #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4) #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5) #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6) #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7) #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8) #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9) extern FL_EXPORT Fl_Boxtype fl_define_FL_GLEAM_UP_BOX(); #define FL_GLEAM_UP_BOX fl_define_FL_GLEAM_UP_BOX() #define FL_GLEAM_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+1) #define FL_GLEAM_UP_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+2) #define FL_GLEAM_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+3) #define FL_GLEAM_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+4) #define FL_GLEAM_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+5) #define FL_GLEAM_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+6) #define FL_GLEAM_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+7) extern FL_EXPORT Fl_Boxtype fl_define_FL_OXY_UP_BOX(); #define FL_OXY_UP_BOX fl_define_FL_OXY_UP_BOX() #define FL_OXY_DOWN_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+1) #define FL_OXY_UP_FRAME (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+2) #define FL_OXY_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+3) #define FL_OXY_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+4) #define FL_OXY_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+5) #define FL_OXY_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+6) #define FL_OXY_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+7) #define FL_OXY_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+8) #define FL_OXY_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+9) #define FL_OXY_BUTTON_UP_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+10) #define FL_OXY_BUTTON_DOWN_BOX (Fl_Boxtype)(fl_define_FL_OXY_UP_BOX()+11) #endif // ! FL_DOXYGEN // conversions of box types to other boxtypes: /** Get the filled version of a frame. If no filled version of a given frame exists, the behavior of this function is undefined and some random box or frame is returned. */ inline Fl_Boxtype fl_box(Fl_Boxtype b) { return (Fl_Boxtype)((b1)?b:(b-2)); } /** Get the "pressed" or "down" version of a box. If no "down" version of a given box exists, the behavior of this function is undefined and some random box or frame is returned. */ inline Fl_Boxtype fl_down(Fl_Boxtype b) { return (Fl_Boxtype)((bvirtual colormap or 24-bit RGB color values. (See \ref drawing_colors for the default FLTK colormap) Color indices occupy the lower 8 bits of the value, while RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
 Fl_Color => 0xrrggbbii
                | | | |
                | | | +--- \ref drawing_colors "index" between 0 and 255
                | | +----- blue color component (8 bit)
                | +------- green component (8 bit)
                +--------- red component (8 bit)
 
A color can have either an index or an rgb value. Colors with rgb set and an index >0 are reserved for special use. */ /**@{*/ /** An FLTK color value; see also \ref drawing_colors */ typedef unsigned int Fl_Color; // Standard colors. These are used as default colors in widgets and altered as necessary const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color // boxtypes generally limit themselves to these colors so // the whole ramp is not allocated: const Fl_Color FL_GRAY0 = 32; // 'A' const Fl_Color FL_DARK3 = 39; // 'H' const Fl_Color FL_DARK2 = 45; // 'N' const Fl_Color FL_DARK1 = 47; // 'P' /** Default background color */ const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color const Fl_Color FL_LIGHT1 = 50; // 'S' const Fl_Color FL_LIGHT2 = 52; // 'U' const Fl_Color FL_LIGHT3 = 54; // 'W' // FLTK provides a 5x8x5 color cube that is used with colormap visuals const Fl_Color FL_BLACK = 56; const Fl_Color FL_RED = 88; const Fl_Color FL_GREEN = 63; const Fl_Color FL_YELLOW = 95; const Fl_Color FL_BLUE = 216; const Fl_Color FL_MAGENTA = 248; const Fl_Color FL_CYAN = 223; const Fl_Color FL_DARK_RED = 72; const Fl_Color FL_DARK_GREEN = 60; const Fl_Color FL_DARK_YELLOW = 76; const Fl_Color FL_DARK_BLUE = 136; const Fl_Color FL_DARK_MAGENTA = 152; const Fl_Color FL_DARK_CYAN = 140; const Fl_Color FL_WHITE = 255; /** Colors numbered between FL_FREE_COLOR and FL_FREE_COLOR + FL_NUM_FREE_COLOR - 1 are free for the user to be given any value using Fl::set_color(). */ #define FL_FREE_COLOR (Fl_Color)16 #define FL_NUM_FREE_COLOR 16 #define FL_GRAY_RAMP (Fl_Color)32 #define FL_NUM_GRAY 24 #define FL_GRAY FL_BACKGROUND_COLOR #define FL_COLOR_CUBE (Fl_Color)56 #define FL_NUM_RED 5 #define FL_NUM_GREEN 8 #define FL_NUM_BLUE 5 FL_EXPORT Fl_Color fl_inactive(Fl_Color c); /** Type of a custom fl_contrast() function. Use this signature to define your own custom fl_contrast() function together with fl_contrast_mode(FL_CONTRAST_CUSTOM). Example: \code Fl_Color my_contrast(Fl_Color fg, Fl_Color bg, int context, int size) { // calculate contrast and ... return color; } // call this early in your main() program: fl_contrast_function(my_contrast); fl_contrast_mode(FL_CONTRAST_CUSTOM); fl_contrast_level(50); // optional, must be called after fl_contrast_mode() \endcode For parameters and types see fl_contrast(Fl_Color, Fl_Color, int, int). \see fl_contrast(Fl_Color, Fl_Color, int, int) \see fl_contrast_mode(int) */ typedef Fl_Color (Fl_Contrast_Function)(Fl_Color, Fl_Color, int, int); FL_EXPORT void fl_contrast_function(Fl_Contrast_Function *f); /** Define the possible modes to calculate fl_contrast(). */ enum Fl_Contrast_Mode { FL_CONTRAST_NONE = 0, ///< always return foreground color FL_CONTRAST_LEGACY, ///< legacy (FLTK 1.3.x) contrast function FL_CONTRAST_CIELAB, ///< new (FLTK 1.4.0) default function FL_CONTRAST_CUSTOM, ///< optional custom contrast function FL_CONTRAST_LAST ///< internal use only (invalid contrast mode) }; // The following functions are defined and documented in src/fl_contrast.cxx FL_EXPORT void fl_contrast_level(int level); FL_EXPORT int fl_contrast_level(); FL_EXPORT void fl_contrast_mode(int mode); FL_EXPORT int fl_contrast_mode(); FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg, int context = 0, int size = 0); FL_EXPORT double fl_lightness(Fl_Color color); FL_EXPORT double fl_luminance(Fl_Color color); // Other color functions are defined and documented in src/fl_color.cxx FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight); /** Returns a lighter version of the specified color. */ inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); } /** Returns a darker version of the specified color. */ inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); } /** Returns the 24-bit color value closest to \p r, \p g, \p b. */ inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) { if (!r && !g && !b) return FL_BLACK; else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8); } /** Returns the 24-bit color value closest to \p g (grayscale). */ inline Fl_Color fl_rgb_color(uchar g) { if (!g) return FL_BLACK; else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8); } /** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1). FL_NUM_GRAY is defined to be 24 in the current FLTK release. To get the closest FLTK gray value to an 8-bit grayscale color 'I' use: \code fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255) \endcode */ inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);} /** Returns a color out of the color cube. \p r must be in the range 0 to FL_NUM_RED (5) minus 1, \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1, \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1. To get the closest color to a 8-bit set of R,G,B values use: \code fl_color_cube(R * (FL_NUM_RED - 1) / 255, G * (FL_NUM_GREEN - 1) / 255, B * (FL_NUM_BLUE - 1) / 255); \endcode */ inline Fl_Color fl_color_cube(int r, int g, int b) { return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);} /**@}*/ // group: Colors /** \name Cursors */ /**@{*/ /** The following constants define the mouse cursors that are available in FLTK. Cursors are provided by the system when available, or bitmaps built into FLTK as a fallback. */ /* FIXME: We should renumber these, but that will break the ABI */ enum Fl_Cursor { FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow: ↖*/ // U+2196 FL_CURSOR_ARROW = 35, /**< an arrow pointer: ↖*/ // U+2196 FL_CURSOR_CROSS = 66, /**< crosshair: +*/ // U+FF0B FL_CURSOR_WAIT = 76, /**< busy indicator (for instance hourglass): ⌚,⌛*/ // U+231A, U+231B FL_CURSOR_INSERT = 77, /**< I-beam: ⌶*/ // U+2336 FL_CURSOR_HAND = 31, /**< pointing hand: ☜*/ // U+261C FL_CURSOR_HELP = 47, /**< question mark pointer: ?*/ FL_CURSOR_MOVE = 27, /**< 4-pointed arrow or hand: ✥, ✋*/ // U+2725, U+270B /* Resize indicators */ FL_CURSOR_NS = 78, /**< up/down resize: ⇕ */ // U+21D5 FL_CURSOR_WE = 79, /**< left/right resize: ⇔*/ // U+21D4 FL_CURSOR_NWSE = 80, /**< diagonal resize: ⤡*/ // U+2921 FL_CURSOR_NESW = 81, /**< diagonal resize: ⤢*/ // U+2922 FL_CURSOR_N = 70, /**< upwards resize: ⤒*/ // U+2912 FL_CURSOR_NE = 69, /**< upwards, right resize: ↗*/ // U+2197 FL_CURSOR_E = 49, /**< rightwards resize: ⇥*/ // U+21E5 FL_CURSOR_SE = 8, /**< downwards, right resize: ⇲*/ // U+21F2 FL_CURSOR_S = 9, /**< downwards resize: ⤓*/ // U+2913 FL_CURSOR_SW = 7, /**< downwards, left resize: ↙*/ // U+2199 FL_CURSOR_W = 36, /**< leftwards resize: ⇤*/ // U+21E4 FL_CURSOR_NW = 68, /**< upwards, left resize: ⇱*/ // U+21F1 FL_CURSOR_NONE =255 /**< invisible. */ }; /**@}*/ // group: Cursors /** FD "when" conditions */ enum { // values for "when" passed to Fl::add_fd() FL_READ = 1, /**< Call the callback when there is data to be read. */ FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */ FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */ }; /** visual types and Fl_Gl_Window::mode() (values match Glut) */ enum Fl_Mode { FL_RGB = 0, FL_INDEX = 1, FL_SINGLE = 0, FL_DOUBLE = 2, FL_ACCUM = 4, FL_ALPHA = 8, FL_DEPTH = 16, FL_STENCIL = 32, FL_RGB8 = 64, FL_MULTISAMPLE= 128, FL_STEREO = 256, FL_FAKE_SINGLE = 512, // Fake single buffered windows using double-buffer FL_OPENGL3 = 1024 }; // image alpha blending #define FL_IMAGE_WITH_ALPHA 0x40000000 /** Damage masks */ enum Fl_Damage { FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */ FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */ FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. Used by other widgets for other widget specific damages. */ FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */ FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */ FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */ FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */ }; // FLTK 1.0.x compatibility definitions (FLTK_1_0_COMPAT) dropped in 1.4.0 /** Arrow types define the type of arrow drawing function. FLTK schemes can draw several graphical elements in their particular way. One of these elements is an arrow type that can be in different GUI elements like scrollbars, choice buttons, and FLTK's Fl_Return_Button. \note This enum is not yet stable (as of FLTK 1.4.0) and may be changed without notice as necessary. \since 1.4.0 */ enum Fl_Arrow_Type { FL_ARROW_SINGLE = 0x01, ///< Single arrow, e.g. in Fl_Scrollbar FL_ARROW_DOUBLE = 0x02, ///< Double arrow, e.g. in Fl_Counter FL_ARROW_CHOICE = 0x03, ///< Dropdown box, e.g. in Fl_Choice FL_ARROW_RETURN = 0x04 ///< Return arrow, e.g. in Fl_Return_Button }; /** Fl_Orientation describes the orientation of a GUI element. FLTK schemes can draw several graphical elements, for instance arrows, pointing at different directions. This enum defines the direction to use for drawing a particular GUI element. The definition of this enum was chosen such that the enum value can be multiplied by 45 to get a rotation angle in degrees starting at the horizontal axis (0 = right, 1 = NE, 2 = up, ...) that can be used with fl_rotate(). Note: angle is counter-clockwise in degrees. The 'unspecified' value \b FL_ORIENT_NONE shall be used for elements that would usually not be rotated, like the return arrow of the Fl_Return_Button. It can still be used as an angle though since it is the same value as \p FL_ORIENT_RIGHT (0 degrees). \note This enum is not yet stable (as of FLTK 1.4.0) and may be changed without notice as necessary. \since 1.4.0 */ enum Fl_Orientation { FL_ORIENT_NONE = 0x00, ///< GUI element direction is unspecified FL_ORIENT_RIGHT = 0x00, ///< GUI element pointing right ( 0°) FL_ORIENT_NE = 0x01, ///< GUI element pointing NE ( 45°) FL_ORIENT_UP = 0x02, ///< GUI element pointing up ( 90°) FL_ORIENT_NW = 0x03, ///< GUI element pointing NW (135°) FL_ORIENT_LEFT = 0x04, ///< GUI element pointing left (180°) FL_ORIENT_SW = 0x05, ///< GUI element pointing SW (225°) FL_ORIENT_DOWN = 0x06, ///< GUI element pointing down (270°) FL_ORIENT_SE = 0x07 ///< GUI element pointing SE (315°) }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl.H ================================================ // // Main header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file FL/Fl.H \brief Fl static class. */ #ifndef Fl_H # define Fl_H #include // build configuration #include #include // for FL_SOCKET #include // experimental #ifdef FLTK_HAVE_CAIRO # include #endif # include "fl_utf8.h" # include "Enumerations.H" # ifndef Fl_Object # define Fl_Object Fl_Widget /**< for back compatibility - use Fl_Widget! */ # endif # ifdef check # undef check # endif # ifdef BSD # undef BSD # endif #include // FIXME: Fl::is_scheme(): strcmp needs string.h class Fl_Widget; class Fl_Window; class Fl_Image; struct Fl_Label; class Fl_Screen_Driver; class Fl_System_Driver; // Pointers you can use to change FLTK to another language. // Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx extern FL_EXPORT const char* fl_local_alt; ///< string pointer used in shortcuts, you can change it to another language extern FL_EXPORT const char* fl_local_ctrl; ///< string pointer used in shortcuts, you can change it to another language extern FL_EXPORT const char* fl_local_meta; ///< string pointer used in shortcuts, you can change it to another language extern FL_EXPORT const char* fl_local_shift; ///< string pointer used in shortcuts, you can change it to another language /** \defgroup callback_functions Callback Function Typedefs \brief Typedefs defined in for callback or handler functions passed as function parameters. FLTK uses callback functions as parameters for some function calls, e.g. to set up global event handlers (Fl::add_handler()), to add a timeout handler (Fl::add_timeout()), and many more. The typedefs defined in this group describe the function parameters used to set up or clear the callback functions and should also be referenced to define the callback function to handle such events in the user's code. \see Fl::add_handler(), Fl::add_timeout(), Fl::repeat_timeout(), Fl::remove_timeout() and others @{ */ /** Signature of some label drawing functions passed as parameters */ typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align); /** Signature of some label measurement functions passed as parameters */ typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int &height); /** Signature of some box drawing functions passed as parameters */ typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color); /** Signature of box focus frame drawing functions */ typedef void (Fl_Box_Draw_Focus_F)(Fl_Boxtype bt, int x, int y, int w, int h, Fl_Color fg, Fl_Color bg); /** Signature of timeout callback functions passed as parameters. Please see Fl::add_timeout() for details. */ typedef void (*Fl_Timeout_Handler)(void *data); /** Signature of some wakeup callback functions passed as parameters */ typedef void (*Fl_Awake_Handler)(void *data); /** Signature of add_idle callback functions passed as parameters */ typedef void (*Fl_Idle_Handler)(void *data); /** Signature of set_idle callback functions passed as parameters */ typedef void (*Fl_Old_Idle_Handler)(); /** Signature of add_fd functions passed as parameters */ typedef void (*Fl_FD_Handler)(FL_SOCKET fd, void *data); /** Signature of add_handler functions passed as parameters */ typedef int (*Fl_Event_Handler)(int event); /** Signature of add_system_handler functions passed as parameters */ typedef int (*Fl_System_Handler)(void *event, void *data); /** Signature of set_abort functions passed as parameters */ typedef void (*Fl_Abort_Handler)(const char *format,...); /** Signature of set_atclose functions passed as parameters */ typedef void (*Fl_Atclose_Handler)(Fl_Window *window, void *data); /** Signature of args functions passed as parameters */ typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i); /** Signature of event_dispatch functions passed as parameters. \see Fl::event_dispatch(Fl_Event_Dispatch) */ typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w); /** Signature of add_clipboard_notify functions passed as parameters */ typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data); /** @} */ /* group callback_functions */ /** The Fl is the FLTK global (static) class containing state information and global methods for the current application. */ class FL_EXPORT Fl { friend class Fl_System_Driver; Fl() {} // no constructor! private: static int use_high_res_GL_; static int draw_GL_text_with_textures_; static int box_shadow_width_; static int box_border_radius_max_; static int selection_to_clipboard_; public: static Fl_Screen_Driver *screen_driver(); static Fl_System_Driver *system_driver(); #ifdef __APPLE__ // deprecated in 1.4 - only for compatibility with 1.3 static void reset_marked_text(); static void insertion_point_location(int x, int y, int height); #endif /** Get the box shadow width of all "shadow" boxtypes in pixels. \since 1.4.0 */ static int box_shadow_width() { return box_shadow_width_; } /** Set the box shadow width of all "shadow" boxtypes in pixels. Must be at least 1, default = 3. There is no upper limit. \since 1.4.0 */ static void box_shadow_width(int W) { box_shadow_width_ = W < 1 ? 1 : W; } /** Get the maximum border radius of all "rounded" boxtypes in pixels. \since 1.4.0 */ static int box_border_radius_max() { return box_border_radius_max_; } /** Set the maximum border radius of all "rounded" boxtypes in pixels. Must be at least 5, default = 15. \note This does \b not apply to the "round" boxtypes which have really round sides (i.e. composed of half circles) as opposed to "rounded" boxtypes that have only rounded corners with a straight border between corners. The box border radius of "rounded" boxtypes is typically calculated as about 2/5 of the box height or width, whichever is smaller. The upper limit can be set by this method for all "rounded" boxtypes. \since 1.4.0 */ static void box_border_radius_max(int R) { box_border_radius_max_ = R < 5 ? 5 : R; } public: // should be private! #ifndef FL_DOXYGEN static int e_number; static int e_x; static int e_y; static int e_x_root; static int e_y_root; static int e_dx; static int e_dy; static int e_state; static int e_clicks; static int e_is_click; static int e_keysym; static char* e_text; static int e_length; static void *e_clipboard_data; static const char *e_clipboard_type; static Fl_Event_Dispatch e_dispatch; static Fl_Callback_Reason callback_reason_; static Fl_Widget* belowmouse_; static Fl_Widget* pushed_; static Fl_Widget* focus_; static int damage_; static Fl_Widget* selection_owner_; static Fl_Window* modal_; static Fl_Window* grab_; static int compose_state; // used for dead keys (Windows) or marked text (MacOS) static void call_screen_init(); // recompute screen number and dimensions #endif // FL_DOXYGEN /** If true then flush() will do something. */ static void damage(int d) {damage_ = d;} public: /** Enumerator for global FLTK options. These options can be set system wide, per user, or for the running application only. \see Fl::option(Fl_Option, bool) \see Fl::option(Fl_Option) */ typedef enum { /// When switched on, moving the text cursor beyond the start or end of /// a text in a text widget will change focus to the next text widget. /// (This is considered 'old' behavior) /// /// When switched off (default), the cursor will stop at the end of the text. /// Pressing Tab or Ctrl-Tab will advance the keyboard focus. /// /// See also: Fl_Input_::tab_nav() /// OPTION_ARROW_FOCUS = 0, // When switched on, FLTK will use the file chooser dialog that comes // with your operating system whenever possible. When switched off, FLTK // will present its own file chooser. // \todo implement me // OPTION_NATIVE_FILECHOOSER, // When Filechooser Preview is enabled, the FLTK or native file chooser // will show a preview of a selected file (if possible) before the user // decides to choose the file. // \todo implement me //OPTION_FILECHOOSER_PREVIEW, /// If visible focus is switched on (default), FLTK will draw a dotted rectangle /// inside the widget that will receive the next keystroke. If switched /// off, no such indicator will be drawn and keyboard navigation /// is disabled. OPTION_VISIBLE_FOCUS, /// If text drag-and-drop is enabled (default), the user can select and drag text /// from any text widget. If disabled, no dragging is possible, however /// dropping text from other applications still works. OPTION_DND_TEXT, /// If tooltips are enabled (default), hovering the mouse over a widget with a /// tooltip text will open a little tooltip window until the mouse leaves /// the widget. If disabled, no tooltip is shown. OPTION_SHOW_TOOLTIPS, /// When switched on (default), Fl_Native_File_Chooser runs GTK file dialogs /// if the GTK library is available on the platform (linux/unix only). /// When switched off, GTK file dialogs aren't used even if the GTK library is available. OPTION_FNFC_USES_GTK, /// Meaningful for the Wayland/X11 platform only. When switched on, the library uses a Zenity-based file dialog. /// When switched off (default), no zenity-based file dialog is used. OPTION_FNFC_USES_ZENITY, /// Meaningful for the Wayland/X11 platform only. /// When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is available on the running system. /// When switched off (default), no kdialog-based file dialog is used. OPTION_FNFC_USES_KDIALOG, /// When switched on (default), Fl_Printer runs the GTK printer dialog /// if the GTK library is available on the platform (linux/unix only). /// When switched off, the GTK printer dialog isn't used even if the GTK library is available. OPTION_PRINTER_USES_GTK, /// When switched on (default), the library shows in a transient yellow window the zoom factor /// value. /// When switched off, no such window gets displayed. OPTION_SHOW_SCALING, /// When switched on and when the keyboard in use has '+' in the shifted position of its key, /// pressing that key and ctrl triggers the zoom-in operation. /// When switched off (default), the zoom-in operation requires that also the shift key is pressed. /// Under macOS, this option has no effect because the OS itself generates ⌘= followed /// by ⌘+ when pressing ⌘ and the '=|+' key without pressing shift. OPTION_SIMPLE_ZOOM_SHORTCUT, // don't change this, leave it always as the last element /// For internal use only. OPTION_LAST } Fl_Option; private: static unsigned char options_[OPTION_LAST]; static unsigned char options_read_; static int program_should_quit_; // non-zero means the program was asked to cleanly terminate public: /* Return a global setting for all FLTK applications, possibly overridden by a setting specifically for this application. */ static bool option(Fl_Option opt); /* Override an option while the application is running. */ static void option(Fl_Option opt, bool val); /** The currently executing idle callback function: DO NOT USE THIS DIRECTLY! This is now used as part of a higher level system allowing multiple idle callback functions to be called. \see add_idle(), remove_idle() */ static void (*idle)(); #ifndef FL_DOXYGEN private: static Fl_Awake_Handler *awake_ring_; static void **awake_data_; static int awake_ring_size_; static int awake_ring_head_; static int awake_ring_tail_; public: static const char* scheme_; static Fl_Image* scheme_bg_; static int e_original_keysym; // late addition static int scrollbar_size_; static int menu_linespacing_; // STR #2927 #endif static int add_awake_handler_(Fl_Awake_Handler, void*); static int get_awake_handler_(Fl_Awake_Handler&, void*&); public: // API version number static double version(); static int api_version(); // ABI version number static int abi_version(); /** Returns whether the runtime library ABI version is correct. This enables you to check the ABI version of the linked FLTK library at runtime. Returns 1 (true) if the compiled ABI version (in the header files) and the linked library ABI version (used at runtime) are the same, 0 (false) otherwise. Argument \p val can be used to query a particular library ABI version. Use for instance 10303 to query if the runtime library is compatible with FLTK ABI version 1.3.3. This is rarely useful. The default \p val argument is FL_ABI_VERSION, which checks the version defined at configure time (i.e. in the header files at program compilation time) against the linked library version used at runtime. This is particularly useful if you linked with a shared object library, but it also concerns static linking. \see Fl::abi_version() */ static inline int abi_check(const int val = FL_ABI_VERSION) { return val == abi_version(); } // argument parsers: static int arg(int argc, char **argv, int& i); static int args(int argc, char **argv, int& i, Fl_Args_Handler cb = 0); static void args(int argc, char **argv); /** Usage string displayed if Fl::args() detects an invalid argument. This may be changed to point to customized text at run-time. */ static const char* const help; // things called by initialization: static void display(const char*); static int visual(int); /** This does the same thing as Fl::visual(int) but also requires OpenGL drawing to work. This must be done if you want to draw in normal windows with OpenGL with gl_start() and gl_end(). It may be useful to call this so your X windows use the same visual as an Fl_Gl_Window, which on some servers will reduce colormap flashing. See Fl_Gl_Window for a list of additional values for the argument. */ static int gl_visual(int, int *alist=0); // platform dependent static void own_colormap(); static void get_system_colors(); static void foreground(uchar, uchar, uchar); static void background(uchar, uchar, uchar); static void background2(uchar, uchar, uchar); // schemes: static int scheme(const char *name); /** See void scheme(const char *name) */ static const char* scheme() {return scheme_;} /** Returns whether the current scheme is the given name. This is a fast inline convenience function to support scheme-specific code in widgets, e.g. in their draw() methods, if required. Use a valid scheme name, not \p NULL (although \p NULL is allowed, this is not a useful argument - see below). If Fl::scheme() has not been set or has been set to the default scheme ("none" or "base"), then this will always return 0 regardless of the argument, because Fl::scheme() is \p NULL in this case. \note The stored scheme name is always lowercase, and this method will do a case-sensitive compare, so you \b must provide a lowercase string to return the correct value. This is intentional for performance reasons. Example: \code if (Fl::is_scheme("gtk+")) { your_code_here(); } \endcode \param[in] name \b lowercase string of requested scheme name. \return 1 if the given scheme is active, 0 otherwise. \see Fl::scheme(const char *name) */ static int is_scheme(const char *name) { return (scheme_ && name && !strcmp(name,scheme_)); } static int reload_scheme(); // defined in 'src/Fl_get_system_colors.cxx' static int scrollbar_size(); static void scrollbar_size(int W); static int menu_linespacing(); static void menu_linespacing(int H); // execution: static int wait(); static double wait(double time); static int check(); static int ready(); static int run(); /** Returns non-zero when a request for program termination was received and accepted. On the MacOS platform, the "Quit xxx" item of the application menu is such a request, that is considered accepted when all windows are closed. On other platforms, this function returns 0 until \p Fl::program_should_quit(1) is called. \version 1.4.0 */ static int program_should_quit() {return program_should_quit_;} /** Indicate to the FLTK library whether a program termination request was received and accepted. A program may set this to 1, for example, while performing a platform-independent command asking the program to cleanly terminate, similarly to the "Quit xxx" item of the application menu under MacOS. \version 1.4.0 */ static void program_should_quit(int should_i) { program_should_quit_ = should_i; } static void hide_all_windows(); static Fl_Widget* readqueue(); // // cross-platform timer support // static void add_timeout(double t, Fl_Timeout_Handler cb, void *data = 0); static void repeat_timeout(double t, Fl_Timeout_Handler cb, void *data = 0); static int has_timeout(Fl_Timeout_Handler cb, void *data = 0); static void remove_timeout(Fl_Timeout_Handler cb, void *data = 0); static int remove_next_timeout(Fl_Timeout_Handler cb, void *data = 0, void **data_return = 0); static void add_check(Fl_Timeout_Handler, void* = 0); static int has_check(Fl_Timeout_Handler, void* = 0); static void remove_check(Fl_Timeout_Handler, void* = 0); static Fl_Timestamp now(double offset = 0); static double seconds_since(Fl_Timestamp& then); static double seconds_between(Fl_Timestamp& back, Fl_Timestamp& further_back); static long ticks_since(Fl_Timestamp& then); static long ticks_between(Fl_Timestamp& back, Fl_Timestamp& further_back); // private static void run_idle(); static void run_checks(); static void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); // platform dependent static void add_fd(int fd, Fl_FD_Handler cb, void* = 0); // platform dependent /** Removes a file descriptor handler. */ static void remove_fd(int, int when); // platform dependent /** Removes a file descriptor handler. */ static void remove_fd(int); // platform dependent static void add_idle(Fl_Idle_Handler cb, void* data = 0); static int has_idle(Fl_Idle_Handler cb, void* data = 0); static void remove_idle(Fl_Idle_Handler cb, void* data = 0); /** If true then flush() will do something. */ static int damage() {return damage_;} static void redraw(); static void flush(); /** \addtogroup group_comdlg @{ */ /** FLTK calls Fl::warning() to output a warning message. The default version on Windows returns \e without printing a warning message, because Windows programs normally don't have stderr (a console window) enabled. The default version on all other platforms prints the warning message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::warning() means that there was a recoverable problem, the display may be messed up, but the user can probably keep working - all X protocol errors call this, for example. The default implementation returns after displaying the message. \note \#include */ static void (*warning)(const char*, ...); /** FLTK calls Fl::error() to output a normal error message. The default version on Windows displays the error message in a MessageBox window. The default version on all other platforms prints the error message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::error() means there is a recoverable error such as the inability to read an image file. The default implementation returns after displaying the message. \note \#include */ static void (*error)(const char*, ...); /** FLTK calls Fl::fatal() to output a fatal error message. The default version on Windows displays the error message in a MessageBox window. The default version on all other platforms prints the error message to stderr. You can override the behavior by setting the function pointer to your own routine. Fl::fatal() must not return, as FLTK is in an unusable state, however your version may be able to use longjmp or an exception to continue, as long as it does not call FLTK again. The default implementation exits with status 1 after displaying the message. \note \#include */ static void (*fatal)(const char*, ...); /** @} */ /** \defgroup fl_windows Windows handling functions \brief Windows and standard dialogs handling declared in @{ */ static Fl_Window* first_window(); static void first_window(Fl_Window*); static Fl_Window* next_window(const Fl_Window*); /** Returns the top-most modal() window currently shown. This is the most recently shown() window with modal() true, or NULL if there are no modal() windows shown(). The modal() window has its handle() method called for all events, and no other windows will have handle() called (grab() overrides this). */ static Fl_Window* modal() {return modal_;} /** Returns the window that currently receives all events. \return The window that currently receives all events, or NULL if event grabbing is currently OFF. */ static Fl_Window* grab() {return grab_;} /** Selects the window to grab. This is used when pop-up menu systems are active. Send all events to the passed window no matter where the pointer or focus is (including in other programs). The window does not have to be shown() , this lets the handle() method of a "dummy" window override all event handling and allows you to map and unmap a complex set of windows (under both X and Windows some window must be mapped because the system interface needs a window id). If grab() is on it will also affect show() of windows by doing system-specific operations (on X it turns on override-redirect). These are designed to make menus popup reliably and faster on the system. To turn off grabbing do Fl::grab(0). Be careful that your program does not enter an infinite loop while grab() is on. On X this will lock up your screen! To avoid this potential lockup, all newer operating systems seem to limit mouse pointer grabbing to the time during which a mouse button is held down. Some OS's may not support grabbing at all. */ static void grab(Fl_Window*); // platform dependent /** @} */ /** \defgroup fl_events Events handling functions Fl class events handling API declared in @{ */ // event information: /** Returns the last event that was processed. This can be used to determine if a callback is being done in response to a keypress, mouse click, etc. */ static int event() {return e_number;} /** Returns the mouse position of the event relative to the Fl_Window it was passed to. */ static int event_x() {return e_x;} /** Returns the mouse position of the event relative to the Fl_Window it was passed to. */ static int event_y() {return e_y;} /** Returns the mouse position on the screen of the event. To find the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y(). */ static int event_x_root() {return e_x_root;} /** Returns the mouse position on the screen of the event. To find the absolute position of an Fl_Window on the screen, use the difference between event_x_root(),event_y_root() and event_x(),event_y(). */ static int event_y_root() {return e_y_root;} /** Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event. Right is positive. */ static int event_dx() {return e_dx;} /** Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event. Down is positive. */ static int event_dy() {return e_dy;} /** Return where the mouse is on the screen by doing a round-trip query to the server. You should use Fl::event_x_root() and Fl::event_y_root() if possible, but this is necessary if you are not sure if a mouse event has been processed recently (such as to position your first window). If the display is not open, this will open it. */ static void get_mouse(int &,int &); /** Returns non zero if we had a double click event. \retval Non-zero if the most recent FL_PUSH or FL_KEYBOARD was a "double click". \retval N-1 for N clicks. A double click is counted if the same button is pressed again while event_is_click() is true. */ static int event_clicks() {return e_clicks;} /** Manually sets the number returned by Fl::event_clicks(). This can be used to set it to zero so that later code does not think an item was double-clicked. \param[in] i corresponds to no double-click if 0, i+1 mouse clicks otherwise \see int event_clicks() */ static void event_clicks(int i) {e_clicks = i;} /** Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last FL_PUSH or FL_KEYBOARD event for it to be considered a "drag" rather than a "click". You can test this on FL_DRAG, FL_RELEASE, and FL_MOVE events. */ static int event_is_click() {return e_is_click;} /** Clears the value returned by Fl::event_is_click(). Useful to prevent the next click from being counted as a double-click or to make a popup menu pick an item with a single click. Don't pass non-zero to this. */ static void event_is_click(int i) {e_is_click = i;} /** Gets which particular mouse button caused the current event. This returns garbage if the most recent event was not a FL_PUSH or FL_RELEASE event. \retval FL_LEFT_MOUSE \retval FL_MIDDLE_MOUSE \retval FL_RIGHT_MOUSE \retval FL_BACK_MOUSE \retval FL_FORWARD_MOUSE \see Fl::event_buttons(), Fl::event_state() */ static int event_button() { return e_keysym - FL_Button; } /** Returns the keyboard and mouse button states of the last event. This is a bitfield of what shift states were on and what mouse buttons were held down during the most recent event. \note FLTK platforms differ in what Fl::event_state() returns when it is called while a modifier key or mouse button is being pressed or released. - Under X11 and Wayland, Fl::event_state() indicates the state of the modifier keys and mouse buttons just \b prior to the event. Thus, during the \c FL_KEYDOWN event generated when pressing the shift key, for example, the \c FL_SHIFT bit of event_state() is 0 and becomes 1 only at the next event which can be any other event, including e.g. \c FL_MOVE. - Under other platforms the reported state of modifier keys or mouse buttons includes that of the key or button being pressed or released. - Fl::event_state() returns the same value under all platforms when it's called while a non-modifier key (e.g. a letter or function key) is being pressed or released. - X servers do not agree on shift states, and \c FL_NUM_LOCK, \c FL_META, and \c FL_SCROLL_LOCK may not work. - The values were selected to match the XFree86 server on Linux. \note This inconsistency \b may be fixed (on X11 and Wayland) in a later release. The legal event state bits are: | Device | State Bit | Key or Button | Since | |----------|----------------|-------------------------|--------| | Keyboard | FL_SHIFT | Shift | | | Keyboard | FL_CAPS_LOCK | Caps Lock | | | Keyboard | FL_CTRL | Ctrl | | | Keyboard | FL_ALT | Alt | | | Keyboard | FL_NUM_LOCK | Num Lock | | | Keyboard | FL_META | Meta, e.g. "Windows" | | | Keyboard | FL_SCROLL_LOCK | Scroll Lock | | | Mouse | FL_BUTTON1 | left button | | | Mouse | FL_BUTTON2 | middle button | | | Mouse | FL_BUTTON3 | right button | | | Mouse | FL_BUTTON4 | side button 1 (back) | 1.3.10 | | Mouse | FL_BUTTON5 | side button 2 (forward) | 1.3.10 | */ static int event_state() {return e_state;} /** Returns non-zero if any of the passed event state bits are turned on. Use \p mask to pass the event states you're interested in. The legal event state bits are defined in Fl::event_state(). */ static int event_state(int mask) {return e_state&mask;} /** Gets which key on the keyboard was last pushed. The returned integer 'key code' is not necessarily a text equivalent for the keystroke. For instance: if someone presses '5' on the numeric keypad with numlock on, Fl::event_key() may return the 'key code' for this key, and NOT the character '5'. To always get the '5', use Fl::event_text() instead. \returns an integer 'key code', or 0 if the last event was not a key press or release. \see int event_key(int), event_text(), compose(int&). */ static int event_key() {return e_keysym;} /** Returns the keycode of the last key event, regardless of the NumLock state. If NumLock is deactivated, FLTK translates events from the numeric keypad into the corresponding arrow key events. event_key() returns the translated key code, whereas event_original_key() returns the keycode before NumLock translation. */ static int event_original_key(){return e_original_keysym;} /** Returns true if the given \p key was held down (or pressed) during the last event. This is constant until the next event is read from the server. Fl::get_key(int) returns true if the given key is held down now. Under X this requires a round-trip to the server and is much slower than Fl::event_key(int). Keys are identified by the unshifted values. FLTK defines a set of symbols that should work on most modern machines for every key on the keyboard: \li All keys on the main keyboard producing a printable ASCII character use the value of that ASCII character (as though shift, ctrl, and caps lock were not on). The space bar is 32. \li All keys on the numeric keypad producing a printable ASCII character use the value of that ASCII character plus FL_KP (e.g., FL_KP + '4', FL_KP + '/'). The highest possible value is FL_KP_Last so you can range-check to see if something is on the keypad. \li All numbered function keys use the number on the function key plus FL_F. The highest possible number is FL_F_Last, so you can range-check a value. \li Buttons on the mouse are considered keys, and use the button number (where the left button is 1) plus FL_Button. \li All other keys on the keypad have a symbol: FL_Escape, FL_BackSpace, FL_Tab, FL_Enter, FL_Print, FL_Scroll_Lock, FL_Pause, FL_Insert, FL_Home, FL_Page_Up, FL_Delete, FL_End, FL_Page_Down, FL_Left, FL_Up, FL_Right, FL_Down, FL_Iso_Key, FL_Shift_L, FL_Shift_R, FL_Control_L, FL_Control_R, FL_Caps_Lock, FL_Alt_L, FL_Alt_R, FL_Meta_L, FL_Meta_R, FL_Menu, FL_Num_Lock, FL_KP_Enter. Be careful not to confuse these with the very similar, but all-caps, symbols used by Fl::event_state(). On X Fl::get_key(FL_Button+n) does not work. On Windows Fl::get_key(FL_KP_Enter) and Fl::event_key(FL_KP_Enter) do not work. */ static int event_key(int key); /** Returns true if the given \p key is held down now. Under X this requires a round-trip to the server and is much slower than Fl::event_key(int). \see event_key(int) */ static int get_key(int key); // platform dependent /** Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events. This can be used in response to FL_KEYUP, FL_KEYDOWN, FL_PASTE, and FL_DND_RELEASE. When responding to FL_KEYUP/FL_KEYDOWN, use this function instead of Fl::event_key() to get the text equivalent of keystrokes suitable for inserting into strings and text widgets. The returned string is guaranteed to be NULL terminated. However, see Fl::event_length() for the actual length of the string, in case the string itself contains NULLs that are part of the text data. \returns A NULL terminated text string equivalent of the last keystroke. */ static const char* event_text() {return e_text;} /** Returns the length of the text in Fl::event_text(). There will always be a nul at this position in the text. However there may be a nul before that if the keystroke translates to a nul character or you paste a nul character. */ static int event_length() {return e_length;} /** During an FL_PASTE event of non-textual data, returns a pointer to the pasted data. The returned data is an Fl_RGB_Image * when the result of Fl::event_clipboard_type() is Fl::clipboard_image. */ static void *event_clipboard() { return e_clipboard_data; } /** Returns the type of the pasted data during an FL_PASTE event. This type can be Fl::clipboard_plain_text or Fl::clipboard_image. */ static const char *event_clipboard_type() {return e_clipboard_type; } static int compose(int &del); static void compose_reset(); static int event_inside(int,int,int,int); static int event_inside(const Fl_Widget*); static int test_shortcut(Fl_Shortcut); static void enable_im(); static void disable_im(); // event destinations: static int handle(int, Fl_Window*); static int handle_(int, Fl_Window*); /** Gets the widget that is below the mouse. \see belowmouse(Fl_Widget*) */ static Fl_Widget* belowmouse() {return belowmouse_;} static void belowmouse(Fl_Widget*); /** Gets the widget that is being pushed. \see void pushed(Fl_Widget*) */ static Fl_Widget* pushed() {return pushed_;} static void pushed(Fl_Widget*); /** Gets the current Fl::focus() widget. \sa Fl::focus(Fl_Widget*) */ static Fl_Widget* focus() {return focus_;} static void focus(Fl_Widget*); static void add_handler(Fl_Event_Handler ha); static void add_handler(Fl_Event_Handler ha, Fl_Event_Handler before); static Fl_Event_Handler last_handler(); static void remove_handler(Fl_Event_Handler h); static void add_system_handler(Fl_System_Handler h, void *data); static void remove_system_handler(Fl_System_Handler h); static void event_dispatch(Fl_Event_Dispatch d); static Fl_Event_Dispatch event_dispatch(); static Fl_Callback_Reason callback_reason(); /** @} */ /** \defgroup fl_clipboard Selection & Clipboard functions FLTK global copy/cut/paste functions declared in @{ */ /** Copies data to the selection buffer, the clipboard, or both. The \p destination can be: - 0: selection buffer (see note below) - 1: clipboard - 2: both The selection buffer exists only on the X11 platform and is used for middle-mouse pastes and for drag-and-drop selections. The clipboard is used for traditional copy/cut/paste operations. On all other platforms the selection buffer (\p destination = 0) is mapped to the clipboard, i.e. on platforms other than X11 all \p destinations are equivalent and the data is always copied to the clipboard. \note Please see Fl::selection_to_clipboard() to enable duplication of the selection buffer to the clipboard on X11, i.e. if \p destination = 0 (selection buffer) \b and Fl::selection_to_clipboard() is enabled, then the data is copied to both the selection buffer and the clipboard. This makes the X11 behavior similar to other platforms but keeps the selection buffer for X11 specific inter process communication. \p type should always be \p Fl::clipboard_plain_text which is the default. Other values are ignored and reserved for future extensions. \note This function is, at present, intended only to copy UTF-8 encoded textual data. To copy graphical data, use the Fl_Copy_Surface class. The \p type argument may allow to copy other kinds of data in the future. \param[in] stuff text data to be copied \param[in] len the number of relevant bytes in \p stuff \param[in] destination 0 = selection, 1 = clipboard, 2 = both (see description) \param[in] type usually plain text (see description) \internal Documented here because it is platform dependent (calls the platform driver): \code Fl::screen_driver()->copy(stuff, len, clipboard, type); \endcode */ static void copy(const char *stuff, int len, int destination = 0, const char *type = Fl::clipboard_plain_text); /** Copies selections on X11 directly to the clipboard if enabled. This method can be called on all platforms. Other platforms than X11 are not affected by this feature. If this is switched on (\p mode = 1), Fl::copy() copies all data to the clipboard regardless of its \p destination argument. If the destination is 0 (selection buffer) data is copied to both the selection buffer and the clipboard. Drag and drop is also affected since drag-and-drop data is copied to the selection buffer. You can use this to make the experience of data selection and copying more like that on other platforms (Windows, macOS, and even Wayland). The default operation mode is the standard X11 behavior (disabled). \note This feature is experimental and enabling it may have unexpected side effects. It is your own responsibility if you enable it. \since 1.4.0 \param[in] mode 1 = enable selection_to_clipboard, 0 = disable selection_to_clipboard \see copy(const char *, int, int, const char *) */ static void selection_to_clipboard(int mode) { selection_to_clipboard_ = mode ? 1 : 0; } /** \brief Returns the current selection_to_clipboard mode. \see void selection_to_clipboard(int) */ static int selection_to_clipboard() { return selection_to_clipboard_; } /** Pastes the data from the selection buffer (\p source is 0) or the clipboard (\p source is 1) into \p receiver. The selection buffer (\p source is 0) is used for middle-mouse pastes and for drag-and-drop selections. The clipboard (\p source is 1) is used for copy/cut/paste operations. If \p source is 1, the optional \p type argument indicates what type of data is requested from the clipboard. At present, Fl::clipboard_plain_text (requesting text data) and Fl::clipboard_image (requesting image data) are possible. Set things up so the handle function of the \p receiver widget will be called with an FL_PASTE event some time in the future if the clipboard does contain data of the requested type. The handle function of \p receiver can process the FL_PASTE event as follows: \li If the \p receiver widget is known to only receive text data, the text string from the specified \p source is in Fl::event_text() with UTF-8 encoding, and the number of bytes is in Fl::event_length(). If Fl::paste() gets called during the drop step of a files-drag-and-drop operation, Fl::event_text() contains a list of filenames (see \ref events_dnd). \li If the \p receiver widget can potentially receive non-text data, use Fl::event_clipboard_type() to determine what sort of data is being sent. If Fl::event_clipboard_type() returns Fl::clipboard_plain_text, proceed as above. It it returns Fl::clipboard_image, the pointer returned by Fl::event_clipboard() can be safely cast to type Fl_RGB_Image * to obtain a pointer to the pasted image. If \p receiver accepts the clipboard image, receiver.handle() should return 1 and the application should take ownership of this image (that is, delete it after use). Conversely, if receiver.handle() returns 0, the application must not use the image. The receiver should be prepared to be called \e directly by this, or for it to happen \e later, or possibly not at all. This allows the window system to take as long as necessary to retrieve the paste buffer (or even to screw up completely) without complex and error-prone synchronization code in FLTK. \par Platform details for image data: \li Unix/Linux platform: Clipboard images in PNG or BMP formats are recognized. Requires linking with the fltk_images library. \li Windows platform: Both bitmap and vectorial (Enhanced metafile) data from clipboard can be pasted as image data. \li Mac OS X platform: Both bitmap (TIFF) and vectorial (PDF) data from clipboard can be pasted as image data. */ static void paste(Fl_Widget &receiver, int source, const char *type = Fl::clipboard_plain_text); /** FLTK will call the registered callback whenever there is a change to the selection buffer or the clipboard. The source argument indicates which of the two has changed. Only changes by other applications are reported. Example: \code void clip_callback(int source, void *data) { if ( source == 0 ) printf("CLIP CALLBACK: selection buffer changed\n"); if ( source == 1 ) printf("CLIP CALLBACK: clipboard changed\n"); } [..] int main() { [..] Fl::add_clipboard_notify(clip_callback); [..] } \endcode \note Some systems require polling to monitor the clipboard and may therefore have some delay in detecting changes. */ static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data = 0); /** Stop calling the specified callback when there are changes to the selection buffer or the clipboard. */ static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h); /** Returns non 0 if the clipboard contains data matching \p type. The clipboard can contain both text and image data; in that situation this function returns non 0 to both requests. This function is \e not meant to check whether the clipboard is empty. This function does not allow to query the selection buffer because FLTK allows to copy/paste non-textual data only from/to the clipboard. \param type can be Fl::clipboard_plain_text or Fl::clipboard_image. */ static int clipboard_contains(const char *type); /** Denotes plain textual data */ static char const * const clipboard_plain_text; /** Denotes image data */ static char const * const clipboard_image; /** Initiate a Drag And Drop operation. The selection buffer should be filled with relevant data before calling this method. FLTK will then initiate the system wide drag and drop handling. Dropped data will be marked as text. Create a selection first using: Fl::copy(const char *stuff, int len, 0) */ static int dnd(); // platform dependent // These are for back-compatibility only: /** back-compatibility only: Gets the widget owning the current selection \see Fl_Widget* selection_owner(Fl_Widget*) */ static Fl_Widget* selection_owner() {return selection_owner_;} static void selection_owner(Fl_Widget*); static void selection(Fl_Widget &owner, const char*, int len); static void paste(Fl_Widget &receiver); /** @} */ /** \defgroup fl_screen Screen functions Fl global screen functions declared in . FLTK supports high-DPI screens using a screen scaling factor. The scaling factor is initialized by the library to a value based on information obtained from the OS. If this initial value is not satisfactory, the FLTK_SCALING_FACTOR environment variable can be set to a value FLTK will multiply to the OS-given value. The 2 variants of functions Fl::screen_scale() allow to programmatically get and set scaling factor values. The scaling factor value can be further changed at runtime by typing \c Ctrl/+/-/0/ (\c Cmd/+/-/0/ under macOS). See \ref events_fl_shortcut for more details about these shortcuts. @{ */ static int x(); // via screen driver static int y(); // via screen driver static int w(); // via screen driver static int h(); // via screen driver // multi-head support: static int screen_count(); // via screen driver static void screen_xywh(int &X, int &Y, int &W, int &H); // via screen driver static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my); // via screen driver static void screen_xywh(int &X, int &Y, int &W, int &H, int n); // via screen driver static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); // via screen driver static int screen_num(int x, int y); // via screen driver static int screen_num(int x, int y, int w, int h); // via screen driver static void screen_dpi(float &h, float &v, int n=0); // via screen driver static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); // via screen driver static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // via screen driver static void screen_work_area(int &X, int &Y, int &W, int &H); // via screen driver static float screen_scale(int n); // via screen driver static void screen_scale(int n, float factor); // via screen driver static int screen_scaling_supported(); static void keyboard_screen_scaling(int value); /** @} */ /** \defgroup fl_attributes Color & Font functions fl global color, font functions. These functions are declared in or . @{ */ // color map: static void set_color(Fl_Color, uchar, uchar, uchar); static void set_color(Fl_Color, uchar, uchar, uchar, uchar); /** Sets an entry in the fl_color index table. You can set it to any 8-bit RGB color. The color is not allocated until fl_color(i) is used. */ static void set_color(Fl_Color i, unsigned c); // platform dependent static unsigned get_color(Fl_Color i); static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue); static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue, uchar &alpha); /** Frees the specified color from the colormap, if applicable. If overlay is non-zero then the color is freed from the overlay colormap. */ static void free_color(Fl_Color i, int overlay = 0); // platform dependent // fonts: static const char* get_font(Fl_Font); /** Get a human-readable string describing the family of this face. This is useful if you are presenting a choice to the user. There is no guarantee that each face has a different name. The return value points to a static buffer that is overwritten each call. The integer pointed to by \p attributes (if the pointer is not zero) is set to zero, FL_BOLD or FL_ITALIC or FL_BOLD | FL_ITALIC. To locate a "family" of fonts, search forward and back for a set with non-zero attributes, these faces along with the face with a zero attribute before them constitute a family. */ static const char* get_font_name(Fl_Font, int* attributes = 0); /** Return an array of sizes in \p sizep. The return value is the length of this array. The sizes are sorted from smallest to largest and indicate what sizes can be given to fl_font() that will be matched exactly (fl_font() will pick the closest size for other sizes). A zero in the first location of the array indicates a scalable font, where any size works, although the array may list sizes that work "better" than others. Warning: the returned array points at a static buffer that is overwritten each call. Under X this will open the display. */ static int get_font_sizes(Fl_Font, int*& sizep); static void set_font(Fl_Font, const char*); static void set_font(Fl_Font, Fl_Font); /** FLTK will open the display, and add every fonts on the server to the face table. It will attempt to put "families" of faces together, so that the normal one is first, followed by bold, italic, and bold italic. The only argument to this function is somewhat obsolete since FLTK and most underlying operating systems move to support Unicode. For completeness, following is the original documentation and a few updates: On X11, the optional argument is a string to describe the set of fonts to add. Passing NULL will select only fonts that have the ISO8859-1 character set (and are thus usable by normal text). Passing "-*" will select all fonts with any encoding as long as they have normal X font names with dashes in them. Passing "*" will list every font that exists (on X this may produce some strange output). Other values may be useful but are system dependent. With the Xft option on Linux, this parameter is ignored. With Windows, `NULL` selects fonts with ANSI_CHARSET encoding and non-NULL selects all fonts. On macOS, this parameter is ignored. The return value is how many faces are in the table after this is done. */ static Fl_Font set_fonts(const char* = 0); // platform dependent /** @} */ /** \defgroup fl_drawings Drawing functions FLTK global graphics and GUI drawing functions. These functions are declared in , and in for offscreen buffer-related ones. @{ */ // /** @} */ // labeltypes: static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*); /** Sets the functions to call to draw and measure a specific labeltype. */ static void set_labeltype(Fl_Labeltype, Fl_Labeltype from); // is it defined ? // boxtypes: static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype); static void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*, uchar, uchar, uchar, uchar, Fl_Box_Draw_Focus_F* =NULL); static void set_boxtype(Fl_Boxtype, Fl_Boxtype from); static int box_dx(Fl_Boxtype); static int box_dy(Fl_Boxtype); static int box_dw(Fl_Boxtype); static int box_dh(Fl_Boxtype); static int draw_box_active(); static Fl_Color box_color(Fl_Color); static void set_box_color(Fl_Color); // back compatibility: /** \addtogroup fl_windows @{ */ /** For back compatibility, sets the void Fl::fatal handler callback */ static void set_abort(Fl_Abort_Handler f) {fatal = f;} static void (*atclose)(Fl_Window*,void*); static void default_atclose(Fl_Window*,void*); /** For back compatibility, sets the Fl::atclose handler callback. You can now simply change the callback for the window instead. \see Fl_Window::callback(Fl_Callback*) */ static void set_atclose(Fl_Atclose_Handler f) {atclose = f;} /** @} */ /** \addtogroup fl_events @{ */ /** Returns non-zero if the Shift key is pressed. */ static int event_shift() {return e_state&FL_SHIFT;} /** Returns non-zero if the Control key is pressed. */ static int event_ctrl() {return e_state&FL_CTRL;} /** Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META. */ static int event_command() {return e_state&FL_COMMAND;} /** Returns non-zero if the Alt key is pressed. */ static int event_alt() {return e_state&FL_ALT;} /** Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now. This function returns the button state at the time of the event. During an FL_RELEASE event, the state of the released button will be 0. To find out, which button caused an FL_RELEASE event, you can use Fl::event_button() instead. \return a bit mask value like { [FL_BUTTON1] | [FL_BUTTON2] | ... | [FL_BUTTON5] } */ static int event_buttons() {return e_state & FL_BUTTONS;} /** Returns non-zero if mouse button 1 is currently held down. For more details, see Fl::event_buttons(). */ static int event_button1() {return e_state & FL_BUTTON1;} /** Returns non-zero if mouse button 2 is currently held down. For more details, see Fl::event_buttons(). */ static int event_button2() {return e_state & FL_BUTTON2;} /** Returns non-zero if mouse button 3 is currently held down. For more details, see Fl::event_buttons(). */ static int event_button3() {return e_state & FL_BUTTON3;} /** Returns non-zero if mouse button 4 is currently held down. For more details, see Fl::event_buttons(). */ static int event_button4() {return e_state & FL_BUTTON4;} /** Returns non-zero if mouse button 5 is currently held down. For more details, see Fl::event_buttons(). */ static int event_button5() {return e_state & FL_BUTTON5;} /** @} */ /** Sets an idle callback. \deprecated This method is obsolete - use the add_idle() method instead. */ static void set_idle(Fl_Old_Idle_Handler cb) {idle = cb;} /** See grab(Fl_Window*) */ static void grab(Fl_Window& win) {grab(&win);} /** Releases the current grabbed window, equals grab(0). \deprecated Use Fl::grab(0) instead. \see grab(Fl_Window*) */ static void release() {grab(0);} // Visible focus methods... /** Gets or sets the visible keyboard focus on buttons and other non-text widgets. The default mode is to enable keyboard focus for all widgets. */ static void visible_focus(int v) { option(OPTION_VISIBLE_FOCUS, (v!=0)); } /** Gets or sets the visible keyboard focus on buttons and other non-text widgets. The default mode is to enable keyboard focus for all widgets. */ static int visible_focus() { return option(OPTION_VISIBLE_FOCUS); } // Drag-n-drop text operation methods... /** Sets whether drag and drop text operations are supported. This specifically affects whether selected text can be dragged from text fields or dragged within a text field as a cut/paste shortcut. */ static void dnd_text_ops(int v) { option(OPTION_DND_TEXT, (v!=0)); } /** Gets whether drag and drop text operations are supported. This returns whether selected text can be dragged from text fields or dragged within a text field as a cut/paste shortcut. */ static int dnd_text_ops() { return option(OPTION_DND_TEXT); } /** \defgroup fl_multithread Multithreading support functions fl multithreading support functions declared in @{ */ // Multithreading support: static int lock(); static void unlock(); static void awake(void* message = 0); /** See void awake(void* message=0). */ static int awake(Fl_Awake_Handler cb, void* message = 0); /** The thread_message() method returns the last message that was sent from a child by the awake() method. See also: \ref advanced_multithreading */ static void* thread_message(); // platform dependent /** @} */ /** \defgroup fl_del_widget Safe widget deletion support functions These functions, declared in , support deletion of widgets inside callbacks. Fl::delete_widget() should be called when deleting widgets or complete widget trees (Fl_Group, Fl_Window, ...) inside callbacks. The other functions are intended for internal use. The preferred way to use them is by using the helper class Fl_Widget_Tracker. The following is to show how it works ... There are three groups of related methods: -# scheduled widget deletion - Fl::delete_widget() schedules widgets for deletion - Fl::do_widget_deletion() deletes all scheduled widgets -# widget watch list ("smart pointers") - Fl::watch_widget_pointer() adds a widget pointer to the watch list - Fl::release_widget_pointer() removes a widget pointer from the watch list - Fl::clear_widget_pointer() clears a widget pointer \e in the watch list -# the class Fl_Widget_Tracker: - the constructor calls Fl::watch_widget_pointer() - the destructor calls Fl::release_widget_pointer() - the access methods can be used to test, if a widget has been deleted \see Fl_Widget_Tracker. @{ */ // Widget deletion: static void delete_widget(Fl_Widget *w); static void do_widget_deletion(); static void watch_widget_pointer(Fl_Widget *&w); static void release_widget_pointer(Fl_Widget *&w); static void clear_widget_pointer(Fl_Widget const *w); /** @} */ /** sets whether GL windows should be drawn at high resolution on Apple computers with retina displays \version 1.3.4 */ static void use_high_res_GL(int val) { use_high_res_GL_ = val; } /** returns whether GL windows should be drawn at high resolution on Apple computers with retina displays. Default is no. \version 1.3.4 */ static int use_high_res_GL() { return use_high_res_GL_; } /** sets whether OpenGL uses textures to draw all text. By default, FLTK draws OpenGL text using textures, if the necessary hardware support is available. Call \p Fl::draw_GL_text_with_textures(0) once in your program before the first call to gl_font() to have FLTK draw instead OpenGL text using a legacy, platform-dependent procedure. It's recommended not to deactivate textures under the MacOS platform because the MacOS legacy procedure is extremely rudimentary. \param val use 0 to prevent FLTK from drawing GL text with textures \see gl_texture_pile_height(int max) \version 1.4.0 */ static void draw_GL_text_with_textures(int val) { draw_GL_text_with_textures_ = val; } /** returns whether whether OpenGL uses textures to draw all text. Default is yes. \see draw_GL_text_with_textures(int val) \version 1.4.0 */ static int draw_GL_text_with_textures() { return draw_GL_text_with_textures_; } static int system(const char *command); // Convert Windows commandline arguments to UTF-8 (documented in src/Fl.cxx) static int args_to_utf8(int argc, char ** &argv); #ifdef FLTK_HAVE_CAIRO /** \defgroup group_cairo Cairo Support Functions and Classes @{ */ public: // Cairo support API static cairo_t *cairo_make_current(Fl_Window *w); /** When FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, any current window dc is linked to a current Cairo context. This is not the default, because it may not be necessary to add Cairo support to all fltk supported windows. When you wish to associate a Cairo context in this mode, you need to call explicitly in your draw() overridden method, Fl::cairo_make_current(Fl_Window*). This will create a Cairo context only for this Window. Still in custom Cairo application it is possible to handle completely this process automatically by setting \p alink to true. In this last case, you don't need anymore to call Fl::cairo_make_current(). You can use Fl::cairo_cc() to get the current Cairo context anytime. \note Only available when configure has the --enable-cairo option */ static void cairo_autolink_context(bool alink) { cairo_state_.autolink(alink); } /** Gets the current autolink mode for Cairo support. \retval false if no Cairo context autolink is made for each window. \retval true if any fltk window is attached a Cairo context when it is current. \see void cairo_autolink_context(bool alink) \note Only available when configure has the --enable-cairo option */ static bool cairo_autolink_context() { return cairo_state_.autolink(); } /** Gets the current Cairo context linked with a fltk window. */ static cairo_t *cairo_cc() { return cairo_state_.cc(); } /** Sets the current Cairo context to \p c. Set \p own to true if you want fltk to handle this cc deletion. \note Only available when configure has the --enable-Cairo option */ static void cairo_cc(cairo_t *c, bool own=false) { cairo_state_.cc(c, own); } /** Flush Cairo drawings on Cairo context \p c. This is \b required on Windows if you use the Cairo context provided by the "Cairo autolink" option. Call this when all your drawings on the Cairo context are finished. This is maybe not necessary on other platforms than Windows but it does no harm if you call it always. You don't need to use this if you use an Fl_Cairo_Window which does this automatically after the draw callback returns. Code example for "Cairo autolink" mode: In the overridden draw() method of your subclass of Fl_Window or any widget: \code cairo_t *cc = Fl::cairo_cc(); // get the "autolink" Cairo context // ... your Cairo drawings are here ... Fl::cairo_flush(cc); // flush Cairo drawings to the device \endcode If you configure FLTK with \c '--enable-cairo' or CMake option \c 'FLTK_OPTION_CAIRO_WINDOW' (i.e. without \c '--enable-cairoext' or CMake option \c 'FLTK_OPTION_CAIRO_EXT') or if you don't enable the \c 'autolink' Cairo context you may do the equivalent to use Cairo drawings in an overridden draw() method of derived classes by using \code // get the Cairo context for the \c window cairo_t *cc = Fl::cairo_make_current(window); // ... your Cairo drawings are here ... Fl::cairo_flush(cc); // flush Cairo drawings to the device \endcode \see Fl::cairo_autolink_context(bool) \see Fl::cairo_make_current(Fl_Window*); */ static void cairo_flush(cairo_t *c) { // flush Cairo drawings: necessary at least for Windows cairo_surface_t *s = cairo_get_target(c); cairo_surface_flush(s); } private: static cairo_t *cairo_make_current(void *gc); static cairo_t *cairo_make_current(void *gc, int W, int H); static Fl_Cairo_State cairo_state_; public: /** @} */ #endif // FLTK_HAVE_CAIRO }; /** This class should be used to control safe widget deletion. You can use an Fl_Widget_Tracker object to watch another widget, if you need to know whether this widget has been deleted during a callback. This simplifies the use of the "safe widget deletion" methods Fl::watch_widget_pointer() and Fl::release_widget_pointer() and makes their use more reliable, because the destructor automatically releases the widget pointer from the widget watch list. Fl_Widget_Tracker is intended to be used as an automatic (local/stack) variable, such that its destructor is called when the object's scope is left. This ensures that no stale widget pointers are left in the widget watch list (see example below). You can also create Fl_Widget_Tracker objects with \c new, but then it is your responsibility to delete the object (and thus remove the widget pointer from the watch list) when it is no longer needed. Example: \code int MyClass::handle (int event) { if (...) { Fl_Widget_Tracker wp(this); // watch myself do_callback(); // call the callback if (wp.deleted()) return 1; // exit, if deleted // Now we are sure that the widget has not been deleted, // and it is safe to access the widget: box(FL_FLAT_BOX); color(FL_WHITE); redraw(); } } \endcode */ class FL_EXPORT Fl_Widget_Tracker { Fl_Widget* wp_; public: Fl_Widget_Tracker(Fl_Widget *wi); ~Fl_Widget_Tracker(); /** Returns a pointer to the watched widget. This pointer is \c NULL, if the widget has been deleted. */ Fl_Widget *widget() {return wp_;} /** Returns 1, if the watched widget has been deleted. This is a convenience method. You can also use something like if (wp.widget() == 0) // ... where \p wp is an Fl_Widget_Tracker object. */ int deleted() {return wp_ == 0;} /** Returns 1, if the watched widget exists (has not been deleted). This is a convenience method. You can also use something like if (wp.widget() != 0) // ... where \p wp is an Fl_Widget_Tracker object. */ int exists() {return wp_ != 0;} }; /** \defgroup fl_unicode Unicode and UTF-8 functions fl global Unicode and UTF-8 handling functions declared in @{ */ /** @} */ #endif // !Fl_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Adjuster.H ================================================ // // Adjuster widget header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Adjuster widget . */ // 3-button "slider", made for Nuke #ifndef Fl_Adjuster_H #define Fl_Adjuster_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif /** The Fl_Adjuster widget was stolen from Prisms, and has proven to be very useful for values that need a large dynamic range. \image html adjuster1.png \image latex adjuster1.png "Fl_Adjuster" width=4cm

When you press a button and drag to the right the value increases. When you drag to the left it decreases. The largest button adjusts by 100 * step(), the next by 10 * step() and that smallest button by step(). Clicking on the buttons increments by 10 times the amount dragging by a pixel does. Shift + click decrements by 10 times the amount. */ class FL_EXPORT Fl_Adjuster : public Fl_Valuator { int drag; int ix; int soft_; protected: void draw() FL_OVERRIDE; int handle(int) FL_OVERRIDE; void value_damage() FL_OVERRIDE; public: Fl_Adjuster(int X,int Y,int W,int H,const char *l=0); /** If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. */ void soft(int s) {soft_ = s;} /** If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. */ int soft() const {return soft_;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Anim_GIF_Image.H ================================================ // // Fl_Anim_GIF_Image class header for the Fast Light Tool Kit (FLTK). // // Copyright 2016-2023 by Christian Grabner . // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Anim_Gif_Image_H #define Fl_Anim_Gif_Image_H // forward declarations class Fl_Image; class Fl_Widget; #include // Load and display animated GIF images class FL_EXPORT Fl_Anim_GIF_Image : public Fl_GIF_Image { class FrameInfo; // internal helper class public: /** When opening an Fl_Anim_GIF_Image there are some options that can be passed in a `flags` value. */ enum Flags { /** This flag indicates to the loader that it should not start the animation immediately after successful load, which is the default. It can be started later using the \ref start() method. */ DONT_START = 1, /** This flag indicates to the loader that it should not resize the canvas widget of the animation to the dimensions of the animation, which is the default. Needed for special use cases. */ DONT_RESIZE_CANVAS = 2, /** This flag indicates to the loader that it should not set the animation as \ref image() member of the canvas widget, which is the default. Needed for special use cases. */ DONT_SET_AS_IMAGE = 4, /** Often frames change just a small area of the animation canvas. This flag indicates to the loader to try using less memory by storing frame data not as canvas-sized images but use the sizes defined in the GIF file. The drawbacks are higher cpu usage during playback and maybe minor artifacts when resized. */ OPTIMIZE_MEMORY = 8, /** This flag can be used to print informations about the decoding process to the console. */ LOG_FLAG = 64, /** This flag can be used to print even more informations about the decoding process to the console. */ DEBUG_FLAG = 128 }; // -- constructors and destructor Fl_Anim_GIF_Image(const char *filename, Fl_Widget *canvas = 0, unsigned short flags = 0); Fl_Anim_GIF_Image(const char* imagename, const unsigned char *data, const size_t length, Fl_Widget *canvas = 0, unsigned short flags = 0); Fl_Anim_GIF_Image(); ~Fl_Anim_GIF_Image() FL_OVERRIDE; // -- file handling bool load(const char *name, const unsigned char *imgdata=NULL, size_t imglength=0); bool valid() const; // -- getters and setters void frame_uncache(bool uncache); bool frame_uncache() const; double delay(int frame_) const; void delay(int frame, double delay); void canvas(Fl_Widget *canvas, unsigned short flags = 0); Fl_Widget *canvas() const; int canvas_w() const; int canvas_h() const; bool is_animated() const; const char *name() const; void speed(double speed); double speed() const; // -- animation int frames() const; void frame(int frame); int frame() const; Fl_Image *image() const; Fl_Image *image(int frame) const; bool start(); bool stop(); bool next(); /** Return if the animation is currently running or stopped. \return true if the animation is running */ bool playing() const { return valid() && Fl::has_timeout(cb_animate, (void *)this); } // -- image data Fl_Anim_GIF_Image& resize(int w, int h); Fl_Anim_GIF_Image& resize(double scale); int frame_x(int frame) const; int frame_y(int frame) const; int frame_w(int frame) const; int frame_h(int frame) const; // -- overridden methods void color_average(Fl_Color c, float i) FL_OVERRIDE; Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Pixmap::copy(); } void desaturate() FL_OVERRIDE; void draw(int x, int y, int w, int h, int cx = 0, int cy = 0) FL_OVERRIDE; void uncache() FL_OVERRIDE; // -- debugging and logging int debug() const; // -- static methods static int frame_count(const char *name, const unsigned char *imgdata = NULL, size_t imglength = 0); /** The loop flag can be used to (dis-)allow loop count. If set (which is the default), the animation will be stopped after the number of repeats specified in the GIF file (typically this count is set to 'forever' anyway). If cleared the animation will always be 'forever', regardless of what is specified in the GIF file. */ static bool loop; /** The min_delay value can be used to set a minimum value for the frame delay for playback. This is to prevent CPU hogs caused by images with very low delay rates. This is a global value for all Fl_Anim_GIF_Image objects. */ static double min_delay; protected: bool next_frame(); void clear_frames(); void set_frame(int frame); static void cb_animate(void *d); void scale_frame(); void set_frame(); void on_frame_data(Fl_GIF_Image::GIF_FRAME &f) FL_OVERRIDE; void on_extension_data(Fl_GIF_Image::GIF_FRAME &f) FL_OVERRIDE; private: char *name_; unsigned short flags_; Fl_Widget *canvas_; bool uncache_; bool valid_; int frame_; // current frame double speed_; FrameInfo *fi_; }; #endif // Fl_Anim_Gif_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_BMP_Image.H ================================================ // // BMP image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_BMP_Image widget . */ #ifndef Fl_BMP_Image_H #define Fl_BMP_Image_H # include "Fl_Image.H" /** The Fl_BMP_Image class supports loading, caching, and drawing of Windows Bitmap (BMP) image files. */ class FL_EXPORT Fl_BMP_Image : public Fl_RGB_Image { public: Fl_BMP_Image(const char* filename); Fl_BMP_Image(const char* imagename, const unsigned char *data, const long length = -1); protected: void load_bmp_(class Fl_Image_Reader &rdr, int ico_height = 0, int ico_width = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Bitmap.H ================================================ // // Bitmap header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Bitmap widget . */ #ifndef Fl_Bitmap_H #define Fl_Bitmap_H #include "Fl_Image.H" #include "Fl_Widget.H" // for fl_uintptr_t class Fl_Widget; struct Fl_Menu_Item; /** The Fl_Bitmap class supports caching and drawing of mono-color (bitmap) images. Images are drawn using the current color. */ class FL_EXPORT Fl_Bitmap : public Fl_Image { friend class Fl_Graphics_Driver; public: /** pointer to raw bitmap data */ const uchar *array; /** Non-zero if array points to bitmap data allocated internally */ int alloc_array; private: /** for internal use */ fl_uintptr_t id_; int cache_w_, cache_h_; // size of bitmap when cached public: /** The constructors create a new bitmap from the specified bitmap data. \see Fl_Bitmap(const uchar *bits, int bits_length, int W, int H) */ Fl_Bitmap(const uchar *bits, int W, int H) : Fl_Image(W,H,0), array(bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);} /** The constructors create a new bitmap from the specified bitmap data. \see Fl_Bitmap(const char *bits, int bits_length, int W, int H) */ Fl_Bitmap(const char *bits, int W, int H) : Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_w_(0),cache_h_(0) {data((const char **)&array, 1);} Fl_Bitmap(const uchar *bits, int bits_length, int W, int H); Fl_Bitmap(const char *bits, int bits_length, int W, int H); virtual ~Fl_Bitmap(); Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Image::copy(); } void draw(int X, int Y, int W, int H, int cx=0, int cy=0) FL_OVERRIDE; void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; int cache_w() {return cache_w_;} int cache_h() {return cache_h_;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Box.H ================================================ // // Box header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file FL/Fl_Box.H \brief Fl_Box widget. */ #ifndef Fl_Box_H #define Fl_Box_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif /** This widget simply draws its box, and possibly its label. Putting it before some other widgets and making it big enough to surround them will let you draw a frame around them. */ class FL_EXPORT Fl_Box : public Fl_Widget { protected: void draw() FL_OVERRIDE; public: /** Creates a new Fl_Box widget with the given coordinates, size, and label. This constructor sets box() to FL_NO_BOX, which means it is invisible. However such widgets are useful as placeholders or Fl_Group::resizable() values. To change the box to something visible, use box(Fl_Boxtype). The destructor removes the box from its parent group. \param[in] X, Y the position of the widget relative to the enclosing window \param[in] W, H size of the widget in pixels \param[in] L optional text for the widget label (default: no label) \see Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *L) */ Fl_Box(int X, int Y, int W, int H, const char *L = 0); /** Creates a new Fl_Box widget with the given boxtype, coordinates, size, and label. This constructor sets box() to the given Fl_Boxtype \c B. You must also specify a label but it can be \c nullptr (0, NULL) if you don't want or need a visible label. The destructor removes the box from its parent group. \param[in] B boxtype of the widget \param[in] X, Y the position of the widget relative to the enclosing window \param[in] W, H size of the widget in pixels \param[in] L optional text for the widget label (see description) \see Fl_Box(int X, int Y, int W, int H, const char *L) */ Fl_Box(Fl_Boxtype B, int X, int Y, int W, int H, const char *L); int handle(int) FL_OVERRIDE; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Browser.H ================================================ // // Browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Browser widget . */ // Forms-compatible browser. Probably useful for other // lists of textual data. Notice that the line numbers // start from 1, and 0 means "no line". #ifndef Fl_Browser_H #define Fl_Browser_H #include "Fl_Browser_.H" #include "Fl_Image.H" struct FL_BLINE; /** The Fl_Browser widget displays a scrolling list of text lines, and manages all the storage for the text. This is not a text editor or spreadsheet! But it is useful for showing a vertical list of named objects to the user. \image html fl_hold_browser.png "Fl_Hold_Browser" \image latex fl_hold_browser.png "Fl_Hold_Browser" width=4cm \par \image html fl_multi_browser.png "Fl_Multi_Browser" \image latex fl_multi_browser.png "Fl_Multi_Browser" width=4cm Each line in the browser is identified by number. The numbers start at one (this is so that zero can be reserved for "no line" in the selective browsers). Unless otherwise noted, the methods do not check to see if the passed line number is in range and legal. It must always be greater than zero and <= size(). Each line contains a null-terminated string of text and a void * data pointer. The text string is displayed, the void * pointer can be used by the callbacks to reference the object the text describes. The base class does nothing when the user clicks on it. The subclasses Fl_Select_Browser, Fl_Hold_Browser, and Fl_Multi_Browser react to user clicks to select lines in the browser and do callbacks. The base class Fl_Browser_ provides the scrolling and selection mechanisms of this and all the subclasses, but the dimensions and appearance of each item are determined by the subclass. You can use Fl_Browser_ to display information other than text, or text that is dynamically produced from your own data structures. If you find that loading the browser is a lot of work or is inefficient, you may want to make a subclass of Fl_Browser_. Some common coding patterns used for working with Fl_Browser: \code // How to loop through all the items in the browser for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..! printf("item #%d, label='%s'\n", t, browser->text(t)); } \endcode Note: If you are subclassing Fl_Browser, it's more efficient to use the protected methods item_first() and item_next(), since Fl_Browser internally uses linked lists to manage the browser's items. For more info, see find_item(int). */ class FL_EXPORT Fl_Browser : public Fl_Browser_ { FL_BLINE *first; // the array of lines FL_BLINE *last; FL_BLINE *cache; int cacheline; // line number of cache int lines; // Number of lines int full_height_; const int* column_widths_; char format_char_; // alternative to @-sign char column_char_; // alternative to tab protected: // required routines for Fl_Browser_ subclass: void* item_first() const FL_OVERRIDE; void* item_next(void* item) const FL_OVERRIDE; void* item_prev(void* item) const FL_OVERRIDE; void* item_last()const FL_OVERRIDE; int item_selected(void* item) const FL_OVERRIDE; void item_select(void* item, int val) FL_OVERRIDE; int item_height(void* item) const FL_OVERRIDE; int item_width(void* item) const FL_OVERRIDE; void item_draw(void* item, int X, int Y, int W, int H) const FL_OVERRIDE; int full_height() const FL_OVERRIDE; int incr_height() const FL_OVERRIDE; const char *item_text(void *item) const FL_OVERRIDE; /** Swap the items \p a and \p b. You must call redraw() to make any changes visible. \param[in] a,b the items to be swapped. \see swap(int,int), item_swap() */ void item_swap(void *a, void *b) FL_OVERRIDE { swap((FL_BLINE*)a, (FL_BLINE*)b); } /** Return the item at specified \p line. \param[in] line The line of the item to return. (1 based) \returns The item, or NULL if line out of range. \see item_at(), find_line(), lineno() */ void *item_at(int line) const FL_OVERRIDE { return (void*)find_line(line); } FL_BLINE* find_line(int line) const ; FL_BLINE* _remove(int line) ; void insert(int line, FL_BLINE* item); int lineno(void *item) const ; void swap(FL_BLINE *a, FL_BLINE *b); public: void remove(int line); void add(const char* newtext, void* d = 0); void insert(int line, const char* newtext, void* d = 0); void move(int to, int from); int load(const char* filename); void swap(int a, int b); void clear(); /** Returns how many lines are in the browser. The last line number is equal to this. Returns 0 if browser is empty. */ int size() const { return lines; } void size(int W, int H) { Fl_Widget::size(W, H); } /** Gets the default text size (in pixels) for the lines in the browser. */ Fl_Fontsize textsize() const { return Fl_Browser_::textsize(); } /* Sets the default text size for the lines in the browser to newSize. Defined and documented in Fl_Browser.cxx */ void textsize(Fl_Fontsize newSize); int topline() const ; /** For internal use only? */ enum Fl_Line_Position { TOP, BOTTOM, MIDDLE }; void lineposition(int line, Fl_Line_Position pos); /** Scrolls the browser so the top item in the browser is showing the specified \p line. \param[in] line The line to be displayed at the top. \see topline(), middleline(), bottomline(), displayed(), lineposition() */ void topline(int line) { lineposition(line, TOP); } /** Scrolls the browser so the bottom item in the browser is showing the specified \p line. \param[in] line The line to be displayed at the bottom. \see topline(), middleline(), bottomline(), displayed(), lineposition() */ void bottomline(int line) { lineposition(line, BOTTOM); } /** Scrolls the browser so the middle item in the browser is showing the specified \p line. \param[in] line The line to be displayed in the middle. \see topline(), middleline(), bottomline(), displayed(), lineposition() */ void middleline(int line) { lineposition(line, MIDDLE); } int select(int line, int val=1); int selected(int line) const ; void show(int line); /** Shows the entire Fl_Browser widget -- opposite of hide(). */ void show() FL_OVERRIDE { Fl_Widget::show(); } void hide(int line); /** Hides the entire Fl_Browser widget -- opposite of show(). */ void hide() FL_OVERRIDE { Fl_Widget::hide(); } int visible(int line) const ; int value() const ; /** Sets the browser's value(), which selects the specified \p line. This is the same as calling select(line). \see select(), selected(), value(), item_select(), item_selected() */ void value(int line) { select(line); } const char* text(int line) const ; void text(int line, const char* newtext); void* data(int line) const ; void data(int line, void* d); Fl_Browser(int X, int Y, int W, int H, const char *L = 0); /** The destructor deletes all list items and destroys the browser. */ ~Fl_Browser() { clear(); } /** Gets the current format code prefix character, which by default is '\@'. A string of formatting codes at the start of each column are stripped off and used to modify how the rest of the line is printed: \li '\@.' Print rest of line, don't look for more '\@' signs \li '\@\@' Doubling the format character prints the format character once, followed by the rest of line \li '\@l' Use a LARGE (24 point) font \li '\@m' Use a medium large (18 point) font \li '\@s' Use a small (11 point) font \li '\@b' Use a bold font (adds FL_BOLD to font) \li '\@i' Use an italic font (adds FL_ITALIC to font) \li '\@f' or '\@t' Use a fixed-pitch font (sets font to FL_COURIER) \li '\@c' Center the line horizontally \li '\@r' Right-justify the text \li '\@N' Use fl_inactive_color() to draw the text \li '\@B0', '\@B1', ... '\@B255' Fill the background with fl_color(n) \li '\@C0', '\@C1', ... '\@C255' Use fl_color(n) to draw the text \li '\@F0', '\@F1', ... Use fl_font(n) to draw the text \li '\@S1', '\@S2', ... Use point size n to draw the text \li '\@u' or '\@_' Underline the text. \li '\@-' draw an engraved line through the middle. Notice that the '\@.' command can be used to reliably terminate the parsing. To print a random string in a random color, use sprintf("@C%d@.%s", color, string) and it will work even if the string starts with a digit or has the format character in it. */ char format_char() const { return format_char_; } /** Sets the current format code prefix character to \p c. The default prefix is '\@'. Set the prefix to 0 to disable formatting. \see format_char() for list of '\@' codes */ void format_char(char c) { format_char_ = c; } /** Gets the current column separator character. The default is '\\t' (tab). \see column_char(), column_widths() */ char column_char() const { return column_char_; } /** Sets the column separator to c. This will only have an effect if you also set column_widths(). The default is '\\t' (tab). \see column_char(), column_widths() */ void column_char(char c) { column_char_ = c; } /** Gets the current column width array. This array is zero-terminated and specifies the widths in pixels of each column. The text is split at each column_char() and each part is formatted into it's own column. After the last column any remaining text is formatted into the space between the last column and the right edge of the browser, even if the text contains instances of column_char() . The default value is a one-element array of just a zero, which means there are no columns. Example: \code Fl_Browser *b = new Fl_Browser(..); static int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column b->column_widths(widths); // assign array to widget b->column_char('\t'); // use tab as the column character b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND"); b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t@b@f/sbin/mingetty tty3"); b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t@b@f/sbin/mingetty tty2"); [..] \endcode \see column_char(), column_widths() */ const int* column_widths() const { return column_widths_; } /** Sets the current array to \p arr. Make sure the last entry is zero. \see column_char(), column_widths() */ void column_widths(const int* arr) { column_widths_ = arr; } /** Returns non-zero if \p line has been scrolled to a position where it is being displayed. Checks to see if the item's vertical position is within the top and bottom edges of the display window. This does NOT take into account the hide()/show() status of the widget or item. \param[in] line The line to be checked \returns 1 if visible, 0 if not visible. \see topline(), middleline(), bottomline(), displayed(), lineposition() */ int displayed(int line) const { return Fl_Browser_::displayed(find_line(line)); } /** Make the item at the specified \p line visible(). Functionally similar to show(int line). If \p line is out of range, redisplay top or bottom of list as appropriate. \param[in] line The line to be made visible. \see show(int), hide(int), display(), visible(), make_visible() */ void make_visible(int line) { if (line < 1) Fl_Browser_::display(find_line(1)); else if (line > lines) Fl_Browser_::display(find_line(lines)); else Fl_Browser_::display(find_line(line)); } // icon support void icon(int line, Fl_Image* icon); Fl_Image* icon(int line) const; void remove_icon(int line); /** For back compatibility only. */ void replace(int a, const char* b) { text(a, b); } void display(int line, int val=1); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Browser_.H ================================================ // // Common browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Browser_ widget . */ // Yes, I know this should be a template... #ifndef Fl_Browser__H #define Fl_Browser__H #ifndef Fl_Group_H #include "Fl_Group.H" #endif #include "Fl_Scrollbar.H" #include // Fl::scrollbar_size() #define FL_NORMAL_BROWSER 0 /**< type() of Fl_Browser */ #define FL_SELECT_BROWSER 1 /**< type() of FL_Select_Browser */ #define FL_HOLD_BROWSER 2 /**< type() of Fl_Hold_Browser */ #define FL_MULTI_BROWSER 3 /**< type() of Fl_Multi_Browser */ #define FL_SORT_ASCENDING 0 /**< sort browser items in ascending alphabetic order. */ #define FL_SORT_DESCENDING 1 /**< sort in descending order */ #define FL_SORT_CASEINSENSITIVE 0x2 /**< sort case insensitively */ /** This is the base class for browsers. To be useful it must be subclassed and several virtual functions defined. The Forms-compatible browser and the file chooser's browser are subclassed off of this. This has been designed so that the subclass has complete control over the storage of the data, although because next() and prev() functions are used to index, it works best as a linked list or as a large block of characters in which the line breaks must be searched for. A great deal of work has been done so that the "height" of a data object does not need to be determined until it is drawn. This is useful if actually figuring out the size of an object requires accessing image data or doing stat() on a file or doing some other slow operation. Callbacks are called when the value changes with \p FL_REASON_CHANGED. If \p FL_WHEN_RELEASE is set, callbacks are called when the mouse button is released with \p FL_REASON_CHANGED or \p FL_REASON_RESELECTED if the selection did not change. If \p FL_WHEN_ENTER_KEY is set, callbacks are also called when key presses or double clicks change the selection. Keyboard navigation of browser items ------------------------------------ The keyboard navigation of browser items is only possible if visible_focus() is enabled. If disabled, the widget rejects keyboard focus; Tab and Shift-Tab focus navigation will skip the widget. In 'Select' and 'Normal' mode, the widget rejects keyboard focus; no navigation keys are supported (other than scrollbar positioning). In 'Hold' mode, the widget accepts keyboard focus, and Up/Down arrow keys can navigate the selected item. In 'Multi' mode, the widget accepts keyboard focus, and Up/Down arrow keys navigate the focus box; Space toggles the current item's selection, Enter selects only the current item (deselects all others). If Shift (or Ctrl) is combined with Up/Down arrow keys, the current item's selection state is extended to the next item. In this way one can extend a selection or de-selection. */ class FL_EXPORT Fl_Browser_ : public Fl_Group { int position_; // where user wants it scrolled to int real_position_; // the current vertical scrolling position int hposition_; // where user wants it panned to int real_hposition_; // the current horizontal scrolling position int offset_; // how far down top_ item the real_position is int max_width; // widest object seen so far uchar has_scrollbar_; // which scrollbars are enabled Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; void* top_; // which item scrolling position is in void* selection_; // which is selected (except for FL_MULTI_BROWSER) void *redraw1,*redraw2; // minimal update pointers void* max_width_item; // which item has max_width_ int scrollbar_size_; // size of scrollbar trough int linespacing_; void update_top(); protected: // All of the following must be supplied by the subclass: /** This method must be provided by the subclass to return the first item in the list. \see item_first(), item_next(), item_last(), item_prev() */ virtual void *item_first() const = 0; /** This method must be provided by the subclass to return the item in the list after \p item. \see item_first(), item_next(), item_last(), item_prev() */ virtual void *item_next(void *item) const = 0; /** This method must be provided by the subclass to return the item in the list before \p item. \see item_first(), item_next(), item_last(), item_prev() */ virtual void *item_prev(void *item) const = 0; /** This method must be provided by the subclass to return the last item in the list. \see item_first(), item_next(), item_last(), item_prev() */ virtual void *item_last() const { return 0L; } /** This method must be provided by the subclass to return the height of \p item in pixels. Allow for two additional pixels for the list selection box. \param[in] item The item whose height is returned. \returns The height of the specified \p item in pixels. \see item_height(), item_width(), item_quick_height() */ virtual int item_height(void *item) const = 0; /** This method must be provided by the subclass to return the width of the \p item in pixels. Allow for two additional pixels for the list selection box. \param[in] item The item whose width is returned. \returns The width of the item in pixels. */ virtual int item_width(void *item) const = 0; virtual int item_quick_height(void *item) const ; /** This method must be provided by the subclass to draw the \p item in the area indicated by \p X, \p Y, \p W, \p H. */ virtual void item_draw(void *item,int X,int Y,int W,int H) const = 0; /** This optional method returns a string (label) that may be used for sorting. \param[in] item The item whose label text is returned. \returns The item's text label. (Can be NULL if blank) */ virtual const char *item_text(void *item) const { (void)item; return 0L; } /** This optional method should be provided by the subclass to efficiently swap browser items \p a and \p b, such as for sorting. \param[in] a,b The two items to be swapped. */ virtual void item_swap(void *a,void *b) { (void)a; (void)b; } /** This method must be provided by the subclass to return the item for the specified \p index. \param[in] index The \p index of the item to be returned \returns The item at the specified \p index. */ virtual void *item_at(int index) const { (void)index; return 0L; } // you don't have to provide these but it may help speed it up: virtual int full_width() const ; // current width of all items virtual int full_height() const ; // current height of all items virtual int incr_height() const ; // average height of an item // These only need to be done by subclass if you want a multi-browser: virtual void item_select(void *item,int val=1); virtual int item_selected(void *item) const ; // things the subclass may want to call: /** Returns the item that appears at the top of the list. */ void *top() const { return top_; } /** Returns the item currently selected, or NULL if there is no selection. For multiple selection browsers this call returns the currently focused item, even if it is not selected. To find all selected items, call Fl_Multi_Browser::selected() for every item in question. */ void *selection() const { return selection_; } void new_list(); // completely clobber all data, as though list replaced void deleting(void *item); // get rid of any pointers to item void replacing(void *a,void *b); // change a pointers to b void swapping(void *a,void *b); // exchange pointers a and b void inserting(void *a,void *b); // insert b near a int displayed(void *item) const ; // true if this item is visible void redraw_line(void *item); // minimal update, no change in size /** This method will cause the entire list to be redrawn. \see redraw_lines(), redraw_line() */ void redraw_lines() { damage(FL_DAMAGE_SCROLL); } // redraw all of them void bbox(int &X,int &Y,int &W,int &H) const; int leftedge() const; // x position after scrollbar & border void *find_item(int ypos); // item under mouse void draw() FL_OVERRIDE; Fl_Browser_(int X,int Y,int W,int H,const char *L=0); public: /** Vertical scrollbar. Public, so that it can be accessed directly. Use `scrollbar_left()` or `scrollbar_right()` to change what side the vertical scrollbar is drawn on. Use `scrollbar.align(int)` (see `Fl_Widget::align(Fl_Align)`) to change what side either of the scrollbars is drawn on. If the `FL_ALIGN_LEFT` bit is on, the vertical scrollbar is on the left. If the `FL_ALIGN_TOP` bit is on, the horizontal scrollbar is on the top. Note that only the alignment flags in scrollbar are considered. The flags in hscrollbar however are ignored. */ Fl_Scrollbar scrollbar; /** Horizontal scrollbar. Public, so that it can be accessed directly. */ Fl_Scrollbar hscrollbar; int handle(int event) FL_OVERRIDE; void resize(int X,int Y,int W,int H) FL_OVERRIDE; int select(void *item,int val=1,int docallbacks=0); int select_only(void *item,int docallbacks=0); int deselect(int docallbacks=0); /** Gets the vertical scroll position of the list as a pixel position \p pos. The position returned is how many pixels of the list are scrolled off the top edge of the screen. Example: A position of '3' indicates the top 3 pixels of the list are scrolled off the top edge of the screen. \see position(), hposition() */ int vposition() const { return position_; } FL_DEPRECATED("since 1.4.0 - use vposition() instead", int position() const) { return vposition(); } void vposition(int pos); // scroll to here FL_DEPRECATED("since 1.4.0 - use vposition(pos) instead", void position(int pos)) { return vposition(pos); } void position(int x, int y) { Fl_Group::position(x, y); } /** Gets the horizontal scroll position of the list as a pixel position \p pos. The position returned is how many pixels of the list are scrolled off the left edge of the screen. Example: A position of '18' indicates the left 18 pixels of the list are scrolled off the left edge of the screen. \see position(), hposition() */ int hposition() const { return hposition_; } void hposition(int); // pan to here void display(void *item); // scroll so this item is shown /** Values for has_scrollbar(). */ /** Anonymous enum bit flags for has_scrollbar(). - bit 0: horizontal - bit 1: vertical - bit 2: 'always' (to be combined with bits 0 and 1) - bit 3-31: reserved for future use */ enum { // values for has_scrollbar() HORIZONTAL = 1, ///< Only show horizontal scrollbar. VERTICAL = 2, ///< Only show vertical scrollbar. BOTH = 3, ///< Show both scrollbars. (default) ALWAYS_ON = 4, ///< Specified scrollbar(s) should 'always' be shown (to be used with HORIZONTAL/VERTICAL) HORIZONTAL_ALWAYS = 5, ///< Horizontal scrollbar always on. VERTICAL_ALWAYS = 6, ///< Vertical scrollbar always on. BOTH_ALWAYS = 7 ///< Both scrollbars always on. }; /** Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar) */ uchar has_scrollbar() const { return has_scrollbar_; } /** Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH). By default you can scroll in both directions, and the scrollbars disappear if the data will fit in the widget. has_scrollbar() changes this based on the value of \p mode: - 0 - No scrollbars. - Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar. - Fl_Browser_::VERTICAL - Only a vertical scrollbar. - Fl_Browser_::BOTH - The default is both scrollbars. - Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. - Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. - Fl_Browser_::BOTH_ALWAYS - Both always on. */ void has_scrollbar(uchar mode) { has_scrollbar_ = mode; } /** Gets the default text font for the lines in the browser. \see textfont(), textsize(), textcolor() */ Fl_Font textfont() const { return textfont_; } /** Sets the default text font for the lines in the browser to \p font. */ void textfont(Fl_Font font) { textfont_ = font; } /** Gets the default text size (in pixels) for the lines in the browser. */ Fl_Fontsize textsize() const { return textsize_; } /** Sets the default text size (in pixels) for the lines in the browser to \p size. */ void textsize(Fl_Fontsize newSize) { textsize_ = newSize; } /** Gets the default text color for the lines in the browser. */ Fl_Color textcolor() const { return textcolor_; } /** Sets the default text color for the lines in the browser to color \p col. */ void textcolor(Fl_Color col) { textcolor_ = col; } /** Gets the current size of the scrollbars' troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbar's width. \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. \see Fl::scrollbar_size(int) */ int scrollbar_size() const { return(scrollbar_size_); } /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets' scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting \p newSize to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. \param[in] newSize Sets the scrollbar size in pixels.\n If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() \see Fl::scrollbar_size() */ void scrollbar_size(int newSize) { scrollbar_size_ = newSize; } /** Returns the global value Fl::scrollbar_size(). \deprecated Use scrollbar_size() instead. \todo This method should eventually be removed in 1.4+ */ int scrollbar_width() const { return(Fl::scrollbar_size()); } /** Sets the global Fl::scrollbar_size(), and forces this instance of the widget to use it. \deprecated Use scrollbar_size() instead. \todo This method should eventually be removed in 1.4+ */ void scrollbar_width(int width) { Fl::scrollbar_size(width); scrollbar_size_ = 0; } /** Moves the vertical scrollbar to the righthand side of the list. For back compatibility. */ void scrollbar_right() { scrollbar.align(FL_ALIGN_RIGHT); } /** Moves the vertical scrollbar to the lefthand side of the list. For back compatibility. */ void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); } void sort(int flags=0); /** Add some space between browser lines. \param[in] pixels number of additional pixels between lines. */ void linespacing(int pixels) { linespacing_ = pixels; } /** Return the height of additional spacing between browser lines. \return spacing height in pixel units. */ int linespacing() const { return linespacing_; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Button.H ================================================ // // Button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Button widget . */ #ifndef Fl_Button_H #define Fl_Button_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif // values for type() #define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and reverts back to 0 when the button is released */ #define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button #define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other buttons in the same group with type() == FL_RADIO_BUTTON are set to zero.*/ #define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*); class Fl_Widget_Tracker; /** \class Fl_Button \brief Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type(uchar) and when(uchar). Buttons can also generate callbacks in response to \c FL_SHORTCUT events. The button can either have an explicit shortcut(int s) value or a letter shortcut can be indicated in the label() with an '\&' character before it. For the label shortcut it does not matter if \e Alt is held down, but if you have an input field in the same window, the user will have to hold down the \e Alt key so that the input field does not eat the event first as an \c FL_KEYBOARD event. \see Fl_Widget::shortcut_label(int) For an Fl_Button object, the type() call returns one of: \li \c FL_NORMAL_BUTTON (0): value() remains unchanged after button press. \li \c FL_TOGGLE_BUTTON: value() is inverted after button press. \li \c FL_RADIO_BUTTON: value() is set to 1 after button press, and all other buttons in the current group with type() == FL_RADIO_BUTTON are set to zero. For an Fl_Button object, the following when() values are useful, the default being \c FL_WHEN_RELEASE: \li \c 0: The callback is not done, instead changed() is turned on. \li \c FL_WHEN_RELEASE: The callback is done after the user successfully clicks the button, or when a shortcut is typed. The reason is \p FL_REASON_RELEASED. \li \c FL_WHEN_CHANGED: The callback is done each time the value() changes (when the user pushes and releases the button, and as the mouse is dragged around in and out of the button). The reason is set to \p FL_REASON_CHANGED \li \c FL_WHEN_NOT_CHANGED: The callback is done when the mouse button is released, but the value did not changed. The reason is set to \p FL_REASON_SELECTED */ class FL_EXPORT Fl_Button : public Fl_Widget { int shortcut_; char value_; char oldval; uchar down_box_; uchar compact_; protected: static Fl_Widget_Tracker *key_release_tracker; static void key_release_timeout(void*); void simulate_key_action(); void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Button(int X, int Y, int W, int H, const char *L = 0); int value(int v); /** Returns the current value of the button (0 or 1). */ char value() const {return value_;} /** Same as \c value(1). \see value(int v) */ int set() {return value(1);} /** Same as \c value(0). \see value(int v) */ int clear() {return value(0);} void setonly(); // this should only be called on FL_RADIO_BUTTONs /** Returns the current shortcut key for the button. \retval int */ int shortcut() const {return shortcut_;} /** Sets the shortcut key to \c s. Setting this overrides the use of '\&' in the label(). The value is a bitwise OR of a key and a set of shift flags, for example: FL_ALT | 'a', or FL_ALT | (FL_F + 10), or just 'a'. A value of 0 disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift flags can be any set of values accepted by Fl::event_state(). If the bit is on, that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift flags (zero for the other bits indicates a "don't care" setting). \param[in] s bitwise OR of key and shift flags */ void shortcut(int s) {shortcut_ = s;} /** Returns the current down box type, which is drawn when value() is non-zero. \retval Fl_Boxtype */ Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;} /** Sets the down box type. The default value of 0 causes FLTK to figure out the correct matching down version of box(). Some derived classes (e.g. Fl_Round_Button and Fl_Light_Button use down_box() for special purposes. See docs of these classes. \param[in] b down box type */ void down_box(Fl_Boxtype b) {down_box_ = b;} /// (for backwards compatibility) void shortcut(const char *s) {shortcut(fl_old_shortcut(s));} /// (for backwards compatibility) Fl_Color down_color() const {return selection_color();} /// (for backwards compatibility) void down_color(unsigned c) {selection_color(c);} // handle flag for compact buttons, documentation in source code void compact(uchar v); /// Return true if buttons are rendered as compact buttons. /// \return 0 if compact mode is off, 1 if it is on /// \see compact(bool) uchar compact() { return compact_; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Cairo.H ================================================ // // Main Cairo support header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Cairo.H Cairo is currently supported for the following platforms: Windows, macOS, Unix/Linux (X11 + Wayland). \note In FLTK 1.3.x this header file (Fl_Cairo.H) included the platform specific Cairo headers. This is no longer true since 1.4.0. This header file is platform agnostic. If you need platform specific Cairo headers you need to \#include them in your source file. To use FLTK's builtin Cairo support you need to \#include \ \b before you include any other FLTK header which is officially required anyway. Since FLTK 1.4.0 the preprocessor constants \p FLTK_HAVE_CAIRO and/or \p FLTK_HAVE_CAIROEXT are defined in \ by including \. */ #ifndef FL_CAIRO_H #define FL_CAIRO_H #include # ifdef FLTK_HAVE_CAIRO # include /** \addtogroup group_cairo @{ */ /** Contains all the necessary info on the current cairo context. A private internal & unique corresponding object is created to permit cairo context state handling while keeping it opaque. For internal use only. \note Only available when configure has the --enable-cairo or --enable-cairoext option or one or both of the CMake options FLTK_OPTION_CAIRO_WINDOW or FLTK_OPTION_CAIRO_EXT is set (ON) */ class FL_EXPORT Fl_Cairo_State { public: Fl_Cairo_State() : cc_(0) , own_cc_(false) , autolink_(false) , window_(0) , gc_(0) {} // access attributes cairo_t *cc() const { return cc_; } ///< Gets the current cairo context bool autolink() const { return autolink_; } ///< Gets the autolink option. See Fl::cairo_autolink_context(bool) /** Sets the current cairo context. \p own == \e true (the default) indicates that the cairo context \p c will be deleted by FLTK internally when another cc is set later. \p own == \e false indicates cc deletion is handled externally by the user program. */ void cc(cairo_t *c, bool own = true) { if (cc_ && own_cc_) cairo_destroy(cc_); cc_ = c; if (!cc_) window_ = 0; own_cc_ = own; } void autolink(bool b); ///< Sets the autolink option, only available with --enable-cairoext void window(void *w) { window_ = w; } ///< Sets the window \p w to keep track on void *window() const { return window_; } ///< Gets the last window attached to a cc void gc(void *c) { gc_ = c; } ///< Sets the gc \p c to keep track on void *gc() const { return gc_; } ///< Gets the last gc attached to a cc private: cairo_t *cc_; // contains the unique autoupdated cairo context bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup bool autolink_; // false by default, prevents the automatic cairo mapping on fltk windows // for custom cairo implementations. void *window_, *gc_; // for keeping track internally of last win+gc treated }; /** @} */ #endif // FLTK_HAVE_CAIRO #endif // FL_CAIRO_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Cairo_Window.H ================================================ // // Fl_Cairo_Window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file FL/Fl_Cairo_Window.H \brief Fl_Cairo_Window, an FLTK window incorporating a Cairo draw callback. */ #ifndef FL_CAIRO_WINDOW_H # define FL_CAIRO_WINDOW_H #include # ifdef FLTK_HAVE_CAIRO // Cairo is currently supported for the following platforms: // Win32, Apple Quartz, X11, Wayland # include # include /** \addtogroup group_cairo @{ */ /** This defines an FLTK window with Cairo support. This class overloads the virtual draw() method for you, so that the only thing you have to do is to provide your Cairo code. All Cairo context handling is achieved transparently. The default coordinate system for Cairo drawing commands within Fl_Cairo_Window is FLTK's coordinate system, where the `x,y,w,h` values are relative to the top/left corner of the Fl_Cairo_Window, as one would expect with regular FLTK drawing commands, e.g.: `(0 ≤ x ≤ w-1), (0 ≤ y ≤ h-1)`. \b Example: \code static void my_cairo_draw_cb(Fl_Cairo_Window *window, cairo_t *cr) { // Draw an "X" const double xmax = (window->w() - 1); const double ymax = (window->h() - 1); cairo_set_line_width(cr, 1.00); // line width for drawing cairo_set_source_rgb(cr, 1.0, 0.5, 0.0); // orange cairo_move_to(cr, 0.0, 0.0); cairo_line_to(cr, xmax, ymax); // draw diagonal "\" cairo_move_to(cr, 0.0, ymax); cairo_line_to(cr, xmax, 0.0); // draw diagonal "/" cairo_stroke(cr); // stroke the lines } \endcode The FLTK coordinate system differs from the default native Cairo coordinate system which uses normalized `(0.0 … 1.0)` values for x and y, e.g.: `(0 ≤ x ≤ 1.0), (0 ≤ y ≤ 1.0)`. So beware of this when copy/pasting Cairo example programs that assume normalized values. If need be, you can revert to the Cairo coordinate system by simply calling `cairo_scale()` with the widget's `w()` and `h()` values. \b Example: \code static void my_cairo_draw_cb(Fl_Cairo_Window *window, cairo_t *cr) { cairo_scale(cr, window->w(), window->h()); // use Cairo's default coordinate system [..use 0.0 to 1.0 values from here on..] } \endcode \see examples/cairo-draw-x.cxx \see test/cairo_test.cxx \note Class Fl_Cairo_Window requires the FLTK library to have been built with CMake option FLTK_OPTION_CAIRO_WINDOW or configure --enable-cairo. \note You can alternatively define your custom Cairo FLTK window, and thus at least override the draw() method to provide custom Cairo support. In this case you will probably use Fl::cairo_make_current(Fl_Window*) to attach a context to your window. You should do this only when your window is the current window. \see Fl_Window::current() */ class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window { public: Fl_Cairo_Window(int W, int H, const char *L = 0) : Fl_Double_Window(W, H, L), draw_cb_(0) {} Fl_Cairo_Window(int X, int Y, int W, int H, const char *L = 0) : Fl_Double_Window(X, Y, W, H, L), draw_cb_(0) {} protected: /** Overloaded to provide Cairo callback support. */ void draw() FL_OVERRIDE { Fl_Double_Window::draw(); if (draw_cb_) { // call the Cairo draw callback // manual method ? if yes explicitly get a cairo_context here if (!Fl::cairo_autolink_context()) Fl::cairo_make_current(this); draw_cb_(this, Fl::cairo_cc()); // flush Cairo drawings: necessary at least for Windows Fl::cairo_flush(Fl::cairo_cc()); } } public: /** The Cairo draw callback prototype you need to implement. */ typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def); /** You must provide a draw callback that implements your Cairo rendering. This method permits you to set your Cairo callback to \p cb. */ void set_draw_cb(cairo_draw_cb cb) { draw_cb_ = cb; } private: cairo_draw_cb draw_cb_; }; /** @} */ # endif // FLTK_HAVE_CAIRO #endif // FL_CAIRO_WINDOW_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Chart.H ================================================ // // Fl_Chart widget header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file FL/Fl_Chart.H \brief Fl_Chart widget. */ #ifndef Fl_Chart_H #define Fl_Chart_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif // values for type() #define FL_BAR_CHART 0 ///< type() for Bar Chart variant #define FL_HORBAR_CHART 1 ///< type() for Horizontal Bar Chart variant #define FL_LINE_CHART 2 ///< type() for Line Chart variant #define FL_FILL_CHART 3 ///< type() for Fill Line Chart variant #define FL_SPIKE_CHART 4 ///< type() for Spike Chart variant #define FL_PIE_CHART 5 ///< type() for Pie Chart variant #define FL_SPECIALPIE_CHART 6 ///< type() for Special Pie Chart variant #define FL_FILLED_CHART FL_FILL_CHART ///< for compatibility #define FL_CHART_MAX 128 ///< max entries per chart #define FL_CHART_LABEL_MAX 18 ///< max label length for entry /** For internal use only. */ struct FL_CHART_ENTRY { float val; ///< For internal use only. unsigned col; ///< For internal use only. char str[FL_CHART_LABEL_MAX + 1]; ///< For internal use only. }; /** \class Fl_Chart \brief Fl_Chart displays simple charts. It is provided for Forms compatibility. \image html charts.png \image latex charts.png "Fl_Chart" width=10cm \todo Refactor Fl_Chart::type() information. The type of an Fl_Chart object can be set using type(uchar t) to: | Chart Type | Description | |---------------------|-------------------------------------------------------------------------------------------------| | FL_BAR_CHART | Each sample value is drawn as a vertical bar. | | FL_FILLED_CHART | The chart is filled from the bottom of the graph to the sample values. | | FL_HORBAR_CHART | Each sample value is drawn as a horizontal bar. | | FL_LINE_CHART | The chart is drawn as a polyline with vertices at each sample value. | | FL_PIE_CHART | A pie chart is drawn with each sample value being drawn as a proportionate slice in the circle. | | FL_SPECIALPIE_CHART | Like \c FL_PIE_CHART, but the first slice is separated from the pie. | | FL_SPIKE_CHART | Each sample value is drawn as a vertical line. | */ class FL_EXPORT Fl_Chart : public Fl_Widget { int numb; int maxnumb; int sizenumb; FL_CHART_ENTRY *entries; double min, max; uchar autosize_; Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; protected: void draw() FL_OVERRIDE; // (static) protected draw methods (STR 2022) // these methods are documented in src/Fl_Chart.cxx static void draw_barchart(int x, int y, int w, int h, int numb, FL_CHART_ENTRY entries[], double min, double max, int autosize, int maxnumb, Fl_Color textcolor); static void draw_horbarchart(int x, int y, int w, int h, int numb, FL_CHART_ENTRY entries[], double min, double max, int autosize, int maxnumb, Fl_Color textcolor); static void draw_linechart(int type, int x, int y, int w, int h, int numb, FL_CHART_ENTRY entries[], double min, double max, int autosize, int maxnumb, Fl_Color textcolor); static void draw_piechart(int x, int y, int w, int h, int numb, FL_CHART_ENTRY entries[], int special, Fl_Color textcolor); public: Fl_Chart(int X, int Y, int W, int H, const char *L = 0); ~Fl_Chart(); void clear(); void add(double val, const char *str = 0, unsigned col = 0); void insert(int ind, double val, const char *str = 0, unsigned col = 0); void replace(int ind, double val, const char *str = 0, unsigned col = 0); /** Gets the lower and upper bounds of the chart values. \param[out] a, b are set to lower, upper */ void bounds(double *a, double *b) const { *a = min; *b = max; } void bounds(double a, double b); /** Returns the number of data values in the chart. */ int size() const { return numb; } /** Sets the widget size (width, height). This is the same as calling Fl_Widget::size(int W, int H); \param[in] W,H new width and height of the widget */ void size(int W, int H) { Fl_Widget::size(W, H); } /** Gets the maximum number of data values for a chart. */ int maxsize() const { return maxnumb; } void maxsize(int m); /** Gets the chart's text font */ Fl_Font textfont() const { return textfont_; } /** Sets the chart's text font to \p s. */ void textfont(Fl_Font s) { textfont_ = s; } /** Gets the chart's text size */ Fl_Fontsize textsize() const { return textsize_; } /** Sets the chart's text size to \p s. */ void textsize(Fl_Fontsize s) { textsize_ = s; } /** Gets the chart's text color */ Fl_Color textcolor() const { return textcolor_; } /** Sets the chart's text color to \p n. */ void textcolor(Fl_Color n) { textcolor_ = n; } /** Gets whether the chart will automatically adjust the bounds of the chart. \returns non-zero if auto-sizing is enabled and zero if disabled. */ uchar autosize() const { return autosize_; } /** Sets whether the chart will automatically adjust the bounds of the chart. \param[in] n non-zero to enable automatic resizing, zero to disable. */ void autosize(uchar n) { autosize_ = n; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Check_Browser.H ================================================ // // Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Check_Browser widget . */ #ifndef Fl_Check_Browser_H #define Fl_Check_Browser_H #include "Fl.H" #include "Fl_Browser_.H" /** The Fl_Check_Browser widget displays a scrolling list of text lines that may be selected and/or checked by the user. */ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ { protected: /* required routines for Fl_Browser_ subclass: */ void *item_first() const FL_OVERRIDE; void *item_next(void *) const FL_OVERRIDE; void *item_prev(void *) const FL_OVERRIDE; int item_height(void *) const FL_OVERRIDE; int item_width(void *) const FL_OVERRIDE; void item_draw(void *, int, int, int, int) const FL_OVERRIDE; void item_select(void *, int) FL_OVERRIDE; int item_selected(void *) const FL_OVERRIDE; const char *item_text(void *item) const FL_OVERRIDE; public: void *item_at(int index) const FL_OVERRIDE; void item_swap(int ia, int ib); void item_swap(void *a, void *b) FL_OVERRIDE; /* private data */ public: // IRIX 5.3 C++ compiler doesn't support private structures... #ifndef FL_DOXYGEN /** For internal use only. */ struct cb_item { cb_item *next; /**< For internal use only. */ cb_item *prev; /**< For internal use only. */ char checked; /**< For internal use only. */ char selected; /**< For internal use only. */ char *text; /**< For internal use only. */ }; #endif // !FL_DOXYGEN private: cb_item *first; cb_item *last; cb_item *cache; int cached_item; int nitems_; int nchecked_; cb_item *find_item(int) const; int lineno(cb_item *) const; public: Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0); /** The destructor deletes all list items and destroys the browser. */ ~Fl_Check_Browser() { clear(); } int add(char *s); // add an (unchecked) item int add(char *s, int b); // add an item and set checked // both return the new nitems() int remove(int item); // delete an item. Returns nitems() // inline const char * methods to avoid breaking binary compatibility... /** See int Fl_Check_Browser::add(char *s) */ int add(const char *s) { return add((char *)s); } /** See int Fl_Check_Browser::add(char *s) */ int add(const char *s, int b) { return add((char *)s, b); } void clear(); // delete all items /** Returns how many lines are in the browser. The last line number is equal to this. */ int nitems() const { return nitems_; } /** Returns how many items are currently checked. */ int nchecked() const { return nchecked_; } int checked(int item) const; void checked(int item, int b); /** Equivalent to Fl_Check_Browser::checked(item, 1). */ void set_checked(int item) { checked(item, 1); } void check_all(); void check_none(); int value() const; // currently selected item char *text(int item) const; // returns pointer to internal buffer protected: int handle(int) FL_OVERRIDE; }; #endif // Fl_Check_Browser_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Check_Button.H ================================================ // // Check button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Check_Button_H #define Fl_Check_Button_H #include "Fl_Light_Button.H" /* class: Fl_Check_Button. A button with a "checkmark" to show its status. */ class FL_EXPORT Fl_Check_Button : public Fl_Light_Button { public: Fl_Check_Button(int X, int Y, int W, int H, const char *L = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Choice.H ================================================ // // Choice header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Choice widget . */ #ifndef Fl_Choice_H #define Fl_Choice_H #include "Fl_Menu_.H" /** \class Fl_Choice \brief A button that is used to pop up a menu. \image html choice.png \image latex choice.png "Fl_Choice" width=4cm This is a button that, when pushed, pops up a menu (or hierarchy of menus) defined by an array of Fl_Menu_Item objects. Motif calls this an OptionButton. The only difference between this and a Fl_Menu_Button is that the name of the most recent chosen menu item is displayed inside the box, while the label is displayed outside the box. However, since the use of this is most often to control a single variable rather than do individual callbacks, some of the Fl_Menu_Button methods are redescribed here in those terms. When the user clicks a menu item, value() is set to that item and then: - The item's callback is done if one has been set; the Fl_Choice is passed as the Fl_Widget* argument, along with any userdata configured for the callback. - If the item does not have a callback, the Fl_Choice widget's callback is done instead, along with any userdata configured for it. The callback can determine which item was picked using value(), mvalue(), item_pathname(), etc. All three mouse buttons pop up the menu. The Forms behavior of the first two buttons to increment/decrement the choice is not implemented. This could be added with a subclass, however. The menu will also pop up in response to shortcuts indicated by putting a '\&' character in the label(). See Fl_Button::shortcut(int s) for a description of this. Typing the shortcut() of any of the items will do exactly the same as when you pick the item with the mouse. The '\&' character in item names are only looked at when the menu is popped up, however. The inherited Fl_Widget::changed() and related methods can be used as follows: \li int Fl_Widget::changed() const This value is true when the user picks a different value. It is turned off by value() and just before doing a callback (the callback can turn it back on if desired). \li void Fl_Widget::set_changed() This method sets the changed() flag. \li void Fl_Widget::clear_changed() This method clears the changed() flag. The inherited Fl_Menu_::down_box() methods can be used as follows: \li Fl_Boxtype Fl_Menu_::down_box() const Gets the current down box, which is used when the menu is popped up. The default down box type is \c FL_DOWN_BOX. \li void Fl_Menu_::down_box(Fl_Boxtype b) Sets the current down box type to \p b. Simple example: \par \code #include #include #include int main() { Fl_Window *win = new Fl_Window(300,200); Fl_Choice *choice = new Fl_Choice(100,10,100,25,"Choice:"); choice->add("Zero"); choice->add("One"); choice->add("Two"); choice->add("Three"); choice->value(2); // make "Two" selected by default (zero based!) win->end(); win->show(); return Fl::run(); } \endcode */ class FL_EXPORT Fl_Choice : public Fl_Menu_ { protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Choice(int X, int Y, int W, int H, const char *L = 0); /** Gets the index of the last item chosen by the user. The index is -1 initially. */ int value() const {return Fl_Menu_::value();} int value(int v); int value(const Fl_Menu_Item* v); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Clock.H ================================================ // // Clock header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Clock, Fl_Clock_Output widgets . */ #ifndef Fl_Clock_H #define Fl_Clock_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif // Values for type(): // Please change doxygen documentation below (class Fl_Clock_Output) // accordingly as well when changing the following type values: #define FL_SQUARE_CLOCK 0 /**< type() of Square Clock variant */ #define FL_ROUND_CLOCK 1 /**< type() of Round Clock variant */ #define FL_ANALOG_CLOCK FL_SQUARE_CLOCK /**< An analog clock is square */ #define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */ // fabien: Please keep the horizontal formatting of both images in class desc, // don't lose vertical space for nothing! /** \class Fl_Clock_Output \brief This widget can be used to display a program-supplied time. The time shown on the clock is not updated. To display the current time, use Fl_Clock instead. \htmlonly
type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK
\endhtmlonly \image html clock.png \htmlonly \endhtmlonly \image html round_clock.png \htmlonly
\endhtmlonly \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm Values for clock type() (\#include \): \code #define FL_SQUARE_CLOCK 0 // Square Clock variant #define FL_ROUND_CLOCK 1 // Round Clock variant #define FL_ANALOG_CLOCK FL_SQUARE_CLOCK // An analog clock is square #define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK // Not yet implemented \endcode */ class FL_EXPORT Fl_Clock_Output : public Fl_Widget { int hour_, minute_, second_; ulong value_; int shadow_; // draw shadows of hands void drawhands(Fl_Color,Fl_Color); // part of draw protected: void draw() FL_OVERRIDE; void draw(int X, int Y, int W, int H); public: Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0); void value(ulong v); // set to this Unix time void value(int H, int m, int s); /** Returns the displayed time. Returns the time in seconds since the UNIX epoch (January 1, 1970). \see value(ulong) */ ulong value() const {return value_;} /** Returns the displayed hour (0 to 23). \see value(), minute(), second() */ int hour() const {return hour_;} /** Returns the displayed minute (0 to 59). \see value(), hour(), second() */ int minute() const {return minute_;} /** Returns the displayed second (0 to 60, 60=leap second). \see value(), hour(), minute() */ int second() const {return second_;} /** Returns the shadow drawing mode of the hands. \returns shadow drawing mode of the hands \retval 0 no shadows \retval 1 draw shadows of hands (default) */ int shadow() const {return shadow_;} /** Sets the shadow drawing mode of the hands. Enables (1) or disables (0) drawing the hands with shadows. Values except 0 and 1 are reserved for future extensions and yield undefined behavior. The default is to draw the shadows (1). \param[in] mode 1 = shadows (default), 0 = no shadows */ void shadow(int mode) { shadow_ = mode ? 1 : 0; } }; // a Fl_Clock displays the current time always by using a timeout: /** \class Fl_Clock \brief This widget provides a round analog clock display. Fl_Clock is provided for Forms compatibility. It installs a 1-second timeout callback using Fl::add_timeout(). You can choose the rounded or square type of the clock with type(). Please see Fl_Clock_Output widget for applicable values. \htmlonly
type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK
\endhtmlonly \image html clock.png \htmlonly \endhtmlonly \image html round_clock.png \htmlonly
\endhtmlonly \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm \see class Fl_Clock_Output */ class FL_EXPORT Fl_Clock : public Fl_Clock_Output { public: int handle(int) FL_OVERRIDE; Fl_Clock(int X, int Y, int W, int H, const char *L = 0); Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L); ~Fl_Clock(); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Color_Chooser.H ================================================ // // Color chooser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2019 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Color_Chooser widget . */ // The color chooser object and the color chooser popup. The popup // is just a window containing a single color chooser and some boxes // to indicate the current and cancelled color. #ifndef Fl_Color_Chooser_H #define Fl_Color_Chooser_H #include #include #include #include #include #ifndef FL_DOXYGEN /** For internal use only */ class FL_EXPORT Flcc_HueBox : public Fl_Widget { int px, py; protected: void draw() FL_OVERRIDE; int handle_key(int); public: int handle(int) FL_OVERRIDE; Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) { px = py = 0;} }; /** For internal use only */ class FL_EXPORT Flcc_ValueBox : public Fl_Widget { int py; protected: void draw() FL_OVERRIDE; int handle_key(int); public: int handle(int) FL_OVERRIDE; Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) { py = 0;} }; /** For internal use only */ class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input { public: int format(char*) FL_OVERRIDE; Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {} }; #endif // !FL_DOXYGEN /** \addtogroup group_comdlg @{ */ /** \class Fl_Color_Chooser \brief The Fl_Color_Chooser widget provides a standard RGB color chooser. \image html fl_color_chooser.jpg \image latex fl_color_chooser.jpg "fl_color_chooser()" width=5cm You can place any number of the widgets into a panel of your own design. The diagram shows the widget as part of a color chooser dialog created by the fl_color_chooser() function. The Fl_Color_Chooser widget contains the hue box, value slider, and rgb input fields from the above diagram (it does not have the color chips or the Cancel or OK buttons). The callback is done every time the user changes the rgb value. It is not done if they move the hue control in a way that produces the \e same rgb value, such as when saturation or value is zero. The fl_color_chooser() function pops up a window to let the user pick an arbitrary RGB color. They can pick the hue and saturation in the "hue box" on the left (hold down CTRL to just change the saturation), and the brightness using the vertical slider. Or they can type the 8-bit numbers into the RGB Fl_Value_Input fields, or drag the mouse across them to adjust them. The pull-down menu lets the user set the input fields to show RGB, HSV, or 8-bit RGB (0 to 255). The user can press CTRL-C to copy the currently selected color value as text in RGB hex format with leading zeroes to the clipboard, for instance \p FL_GREEN would be '00FF00' (since FLTK 1.4.0). fl_color_chooser() returns non-zero if the user picks ok, and updates the RGB values. If the user picks cancel or closes the window this returns zero and leaves RGB unchanged. If you use the color chooser on an 8-bit screen, it will allocate all the available colors, leaving you no space to exactly represent the color the user picks! You can however use fl_rectf() to fill a region with a simulated color using dithering. Callback reasons can be \c FL_REASON_DRAGGED, \c FL_REASON_CHANGED, or \c FL_REASON_RESELECTED. */ /** @} */ class FL_EXPORT Fl_Color_Chooser : public Fl_Group { Flcc_HueBox huebox; Flcc_ValueBox valuebox; Fl_Choice choice; Flcc_Value_Input rvalue; Flcc_Value_Input gvalue; Flcc_Value_Input bvalue; Fl_Box resize_box; double hue_, saturation_, value_; double r_, g_, b_; void set_valuators(); static void rgb_cb(Fl_Widget*, void*); static void mode_cb(Fl_Widget*, void*); public: int handle(int e) FL_OVERRIDE; /** Returns which Fl_Color_Chooser variant is currently active \return color modes are rgb(0), byte(1), hex(2), or hsv(3) */ int mode() {return choice.value();} /** Set which Fl_Color_Chooser variant is currently active \param[in] newMode color modes are rgb(0), byte(1), hex(2), or hsv(3) */ void mode(int newMode); /** Returns the current hue. 0 <= hue < 6. Zero is red, one is yellow, two is green, etc. This value is convenient for the internal calculations - some other systems consider hue to run from zero to one, or from 0 to 360. */ double hue() const {return hue_;} /** Returns the saturation. 0 <= saturation <= 1. */ double saturation() const {return saturation_;} /** Returns the value/brightness. 0 <= value <= 1. */ double value() const {return value_;} /** Returns the current red value. 0 <= r <= 1. */ double r() const {return r_;} /** Returns the current green value. 0 <= g <= 1. */ double g() const {return g_;} /** Returns the current blue value. 0 <= b <= 1. */ double b() const {return b_;} int hsv(double H, double S, double V); int rgb(double R, double G, double B); static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B); static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V); Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0); }; FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b, int m=-1); FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1); #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Copy_Surface.H ================================================ // // Copy-to-clipboard code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Copy_Surface_H #define Fl_Copy_Surface_H #include /** Supports copying of graphical data to the clipboard.
After creation of an Fl_Copy_Surface object, make it the current drawing surface calling Fl_Surface_Device::push_current(), and all subsequent graphics requests will be recorded in the clipboard. It's possible to draw widgets (using Fl_Copy_Surface::draw() ) or to use any of the \ref fl_drawings or the \ref fl_attributes. Finally, delete the Fl_Copy_Surface object to load the clipboard with the graphical data.
Fl_Gl_Window 's can be copied to the clipboard as well.
Usage example: \code Fl_Widget *g = ...; // a widget you want to copy to the clipboard Fl_Copy_Surface *copy_surf = new Fl_Copy_Surface(g->w(), g->h()); // create an Fl_Copy_Surface object Fl_Surface_Device::push_current(copy_surf); // direct graphics requests to the clipboard fl_color(FL_WHITE); fl_rectf(0, 0, g->w(), g->h()); // draw a white background copy_surf->draw(g); // draw the g widget in the clipboard Fl_Surface_Device::pop_current(); // direct graphics requests back to their previous destination delete copy_surf; // after this, the clipboard is loaded \endcode Platform details: \li Windows: Transparent RGB images copy without transparency. The graphical data are copied to the clipboard in two formats: 1) as an 'enhanced metafile'; 2) as a color bitmap. Applications to which the clipboard content is pasted can use the format that suits them best. \li Mac OS: The graphical data are copied to the clipboard (a.k.a. pasteboard) in two 'flavors': 1) in vectorial form as PDF data; 2) in bitmap form as a TIFF image. Applications to which the clipboard content is pasted can use the flavor that suits them best. \li X11 and Wayland: the graphical data are copied to the clipboard as an image in BMP format. */ class FL_EXPORT Fl_Copy_Surface : public Fl_Widget_Surface { private: class Fl_Copy_Surface_Driver *platform_surface; protected: void translate(int x, int y) FL_OVERRIDE; void untranslate() FL_OVERRIDE; public: Fl_Copy_Surface(int w, int h); ~Fl_Copy_Surface(); void set_current() FL_OVERRIDE; bool is_current() FL_OVERRIDE; /** Returns the pixel width of the copy surface */ int w(); /** Returns the pixel height of the copy surface */ int h(); void origin(int *x, int *y) FL_OVERRIDE; void origin(int x, int y) FL_OVERRIDE; int printable_rect(int *w, int *h) FL_OVERRIDE; }; /** \cond DriverDev \addtogroup DriverDeveloper \{ */ /** A base class describing the interface between FLTK and draw-to-clipboard operations. This class is only for internal use by the FLTK library. A supported platform should implement the virtual methods of this class in order to support drawing to the clipboard through class Fl_Copy_Surface. */ class Fl_Copy_Surface_Driver : public Fl_Widget_Surface { friend class Fl_Copy_Surface; protected: int width; int height; Fl_Copy_Surface_Driver(int w, int h) : Fl_Widget_Surface(NULL), width(w), height(h) {} virtual ~Fl_Copy_Surface_Driver() {} void set_current() FL_OVERRIDE = 0; void translate(int x, int y) FL_OVERRIDE = 0; void untranslate() FL_OVERRIDE = 0; int printable_rect(int *w, int *h) FL_OVERRIDE; /** Each platform implements this function its own way. It returns an object implementing all virtual functions of class Fl_Copy_Surface_Driver for the platform. */ static Fl_Copy_Surface_Driver *newCopySurfaceDriver(int w, int h); }; /** \} \endcond */ #endif // Fl_Copy_Surface_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Counter.H ================================================ // // Counter header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Counter widget . */ // A numerical value with up/down step buttons. From Forms. #ifndef Fl_Counter_H #define Fl_Counter_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif // values for type(): #define FL_NORMAL_COUNTER 0 /**< type() for counter with fast buttons */ #define FL_SIMPLE_COUNTER 1 /**< type() for counter without fast buttons */ /** Controls a single floating point value with button (or keyboard) arrows. Double arrows buttons achieve larger steps than simple arrows. \see Fl_Spinner for value input with vertical step arrows. \image html counter.png \image latex counter.png "Fl_Counter" width=4cm The type of an Fl_Counter object can be set using Fl_Widget::type(uchar) to: \li \c FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons. \li \c FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons. */ class FL_EXPORT Fl_Counter : public Fl_Valuator { Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; double lstep_; uchar mouseobj_; static void repeat_callback(void *); int calc_mouseobj(); void increment_cb(); protected: void draw() FL_OVERRIDE; // compute widths of arrow boxes void arrow_widths(int &w1, int &w2); public: int handle(int) FL_OVERRIDE; Fl_Counter(int X, int Y, int W, int H, const char* L = 0); ~Fl_Counter(); /** Sets the increment for the large step buttons. The default value is 1.0. \param[in] a large step increment. */ void lstep(double a) {lstep_ = a;} /** Sets the increments for the normal and large step buttons. \param[in] a, b normal and large step increments. */ void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;} /** Sets the increment for the normal step buttons. \param[in] a normal step increment. */ void step(double a) {Fl_Valuator::step(a);} /** Returns the increment for normal step buttons. */ double step() const {return Fl_Valuator::step();} /** Gets the text font */ Fl_Font textfont() const {return textfont_;} /** Sets the text font to \p s */ void textfont(Fl_Font s) {textfont_ = s;} /** Gets the font size */ Fl_Fontsize textsize() const {return textsize_;} /** Sets the font size to \p s */ void textsize(Fl_Fontsize s) {textsize_ = s;} /** Gets the font color */ Fl_Color textcolor() const {return textcolor_;} /** Sets the font color to \p s */ void textcolor(Fl_Color s) {textcolor_ = s;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Device.H ================================================ // // Definition of classes Fl_Surface_Device, Fl_Display_Device // for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2021 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Device.H \brief declaration of classes Fl_Surface_Device, Fl_Display_Device, Fl_Device_Plugin. */ #ifndef Fl_Device_H #define Fl_Device_H #include #include class Fl_Graphics_Driver; class Fl_RGB_Image; class Fl_Widget; class Fl_Image_Surface; /** A drawing surface that's susceptible to receive graphical output. Any FLTK application has at any time a current drawing surface to which all drawing requests are directed. The current surface is given by Fl_Surface_Device::surface(). When main() begins running, the current drawing surface has been set to the computer's display, an instance of the Fl_Display_Device class. A drawing surface other than the computer's display, is typically used as follows:

  1. Create \c surface, an object from an Fl_Surface_Device derived class (e.g., Fl_Image_Surface, Fl_Printer, Fl_Copy_Surface).
  2. Call \c Fl_Surface_Device::push_current(surface); to redirect all graphics requests to \c surface which becomes the new current drawing surface (not necessary with classes Fl_Printer / Fl_PostScript_File_Device / Fl_PDF_File_Surface because it is done by Fl_Paged_Device::begin_page()).
  3. At this point all of the \ref fl_drawings (e.g., fl_rect()) or the \ref fl_attributes or \ref drawing_images functions (e.g., fl_draw_image(), Fl_Image::draw()) operate on the new current drawing surface. It's also possible to draw to the current surface any widget with Fl_Widget_Surface::draw(Fl_Widget*, int, int), a window and its titlebar with Fl_Widget_Surface::draw_decorated_window(), or the content of a rectangular zone of a window with Fl_Widget_Surface::print_window_part().
  4. After all drawing requests have been performed, redirect graphics requests back to their previous destination with \c Fl_Surface_Device::pop_current(); (not necessary with classes Fl_Printer / Fl_PostScript_File_Device / Fl_PDF_File_Surface).
  5. Delete \c surface.
For back-compatibility, it is also possible to use the Fl_Surface_Device::set_current() member function to change the current drawing surface, once to the new surface, once to the previous one. */ class FL_EXPORT Fl_Surface_Device { /** The graphics driver in use by this surface. */ Fl_Graphics_Driver *pGraphicsDriver; static Fl_Surface_Device *surface_; // the surface that currently receives graphics requests static Fl_Surface_Device *default_surface(); // create surface if none exists yet protected: /** FLTK calls this each time a surface ceases to be the current drawing surface. This member function is mostly of interest to developers of new Fl_Surface_Device derived classes. It allows to perform surface-specific operations necessary when this surface ceases to be current. Each implementation should end with a call to Fl_Surface_Device::end_current(). */ virtual void end_current() { surface_ = 0;} /** Constructor that sets the graphics driver to use for the created surface. */ Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver; } /** Sets the graphics driver of this drawing surface. */ inline void driver(Fl_Graphics_Driver *graphics_driver) {pGraphicsDriver = graphics_driver;} public: virtual void set_current(void); virtual bool is_current(); /** \brief Returns the graphics driver of this drawing surface. */ inline Fl_Graphics_Driver *driver() {return pGraphicsDriver; } /** The current drawing surface. In other words, the Fl_Surface_Device object that currently receives all graphics requests. \note It's possible to transiently remove the GUI scaling factor in place in the current drawing surface with \ref fl_override_scale(). */ static inline Fl_Surface_Device *surface() { return surface_ ? surface_ : default_surface(); } /** \brief The destructor. */ virtual ~Fl_Surface_Device(); static void push_current(Fl_Surface_Device *new_current); static Fl_Surface_Device *pop_current(); }; /** The computer's display. When FLTK begins to access the computer's display, it creates an object of class Fl_Display_Device and makes it the current drawing surface. */ class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device { Fl_Display_Device(Fl_Graphics_Driver *graphics_driver); public: static Fl_Display_Device *display_device(); }; /** This plugin socket allows the integration of new device drivers for special window or screen types. This class is not intended for use outside the FLTK library. It is currently used to provide an automated printing service and screen capture for OpenGL windows, if linked with fltk_gl. */ class Fl_Device_Plugin : public Fl_Plugin { public: /** \brief The constructor */ Fl_Device_Plugin(const char *pluginName) : Fl_Plugin(klass(), pluginName) { } /** \brief Returns the class name */ virtual const char *klass() { return "fltk:device"; } /** \brief Returns the plugin name */ virtual const char *name() = 0; /** \brief Prints a widget */ virtual int print(Fl_Widget* w) = 0; /** Captures a rectangle of a widget as an image \return The captured pixels as an RGB image */ virtual Fl_RGB_Image* rectangle_capture(Fl_Widget *widget, int x, int y, int w, int h) = 0; /** Returns the OpenGL plugin */ static Fl_Device_Plugin *opengl_plugin(); }; #endif // Fl_Device_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Dial.H ================================================ // // Dial header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Dial widget . */ #ifndef Fl_Dial_H #define Fl_Dial_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif // values for type(): #define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */ #define FL_LINE_DIAL 1 /**< type() for dial variant with line */ #define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */ /** The Fl_Dial widget provides a circular dial to control a single floating point value. \image html dial.png \image latex dial.png "Fl_Dial" width=4cm Use type() to set the type of the dial to:
  • FL_NORMAL_DIAL - Draws a normal dial with a knob.
  • FL_LINE_DIAL - Draws a dial with a line.
  • FL_FILL_DIAL - Draws a dial with a filled arc.
*/ class FL_EXPORT Fl_Dial : public Fl_Valuator { short a1,a2; protected: // these allow subclasses to put the dial in a smaller area: void draw(int X, int Y, int W, int H); int handle(int event, int X, int Y, int W, int H); void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; /** Creates a new Fl_Dial widget using the given position, size, and label string. The default type is FL_NORMAL_DIAL. */ Fl_Dial(int x,int y,int w,int h, const char *l = 0); /** Sets Or gets the angles used for the minimum and maximum values. The default values are 45 and 315 (0 degrees is straight down and the angles progress clockwise). Normally angle1 is less than angle2, but if you reverse them the dial moves counter-clockwise. */ short angle1() const {return a1;} /** See short angle1() const */ void angle1(short a) {a1 = a;} /** See short angle1() const */ short angle2() const {return a2;} /** See short angle1() const */ void angle2(short a) {a2 = a;} /** See short angle1() const */ void angles(short a, short b) {a1 = a; a2 = b;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Double_Window.H ================================================ // // Double-buffered window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Double_Window widget . */ #ifndef Fl_Double_Window_H #define Fl_Double_Window_H #include "Fl_Window.H" /** The Fl_Double_Window provides a double-buffered window. It will draw the window data into an off-screen pixmap, and then copy it to the on-screen window. */ class FL_EXPORT Fl_Double_Window : public Fl_Window { public: Fl_Double_Window *as_double_window() FL_OVERRIDE {return this; } void show() FL_OVERRIDE; /** Same as Fl_Window::show(int a, char **b) */ void show(int a, char **b) {Fl_Window::show(a,b);} void resize(int,int,int,int) FL_OVERRIDE; void hide() FL_OVERRIDE; void flush() FL_OVERRIDE; ~Fl_Double_Window(); /** Creates a new Fl_Double_Window widget using the given position, size, and label (title) string. */ Fl_Double_Window(int W, int H, const char *l = 0); /** See Fl_Double_Window::Fl_Double_Window(int w, int h, const char *label = 0) */ Fl_Double_Window(int X, int Y, int W, int H, const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Export.H ================================================ /* * Windows DLL export . * * Copyright 1998-2018 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ #ifndef Fl_Export_H # define Fl_Export_H /* * The following is used when building DLLs under Windows * and when building .so's under unix/linux. */ # if defined(FL_DLL) # ifdef FL_LIBRARY # define FL_EXPORT __declspec(dllexport) # else # define FL_EXPORT __declspec(dllimport) # endif /* FL_LIBRARY */ # elif __GNUC__ >= 4 # define FL_EXPORT __attribute__ ((visibility ("default"))) # else # define FL_EXPORT # endif /* FL_DLL */ #endif /* !Fl_Export_H */ ================================================ FILE: Game Trainers/common/include/FL/Fl_File_Browser.H ================================================ // // FileBrowser definitions. // // Copyright 1999-2010 by Michael Sweet. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_File_Browser widget . */ // // Include necessary header files... // #ifndef _Fl_File_Browser_H_ # define _Fl_File_Browser_H_ # include "Fl_Browser.H" # include "Fl_File_Icon.H" # include "filename.H" // // Fl_File_Browser class... // /** The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons. */ class FL_EXPORT Fl_File_Browser : public Fl_Browser { int filetype_; const char *directory_; uchar iconsize_; const char *pattern_; const char *errmsg_; int full_height() const FL_OVERRIDE; int item_height(void *) const FL_OVERRIDE; int item_width(void *) const FL_OVERRIDE; void item_draw(void *, int, int, int, int) const FL_OVERRIDE; int incr_height() const FL_OVERRIDE { return (item_height(0) + linespacing()); } public: enum { FILES, DIRECTORIES }; Fl_File_Browser(int, int, int, int, const char * = 0); ~Fl_File_Browser(); /** Sets or gets the size of the icons. The default size is 20 pixels. */ uchar iconsize() const { return (iconsize_); } /** Sets or gets the size of the icons. The default size is 20 pixels. */ void iconsize(uchar s) { iconsize_ = s; redraw(); } /** Sets or gets the filename filter. The pattern matching uses the fl_filename_match() function in FLTK. */ void filter(const char *pattern); /** Sets or gets the filename filter. The pattern matching uses the fl_filename_match() function in FLTK. */ const char *filter() const { return (pattern_); } int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort); Fl_Fontsize textsize() const { return Fl_Browser::textsize(); } void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); } /** Sets or gets the file browser type, FILES or DIRECTORIES. When set to FILES, both files and directories are shown. Otherwise only directories are shown. */ int filetype() const { return (filetype_); } /** Sets or gets the file browser type, FILES or DIRECTORIES. When set to FILES, both files and directories are shown. Otherwise only directories are shown. */ void filetype(int t) { filetype_ = t; } void errmsg(const char *emsg); /** Returns OS error messages, or NULL if none. Use when advised. */ const char* errmsg() const { return errmsg_; } }; #endif // !_Fl_File_Browser_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_File_Chooser.H ================================================ // // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // ======================================================================= // DO NOT EDIT FL/Fl_File_Chooser.H and src/Fl_File_Chooser.cxx !!! // ======================================================================= // Please use fluid to change src/Fl_File_Chooser.fl interactively // and then use fluid to "write code" or edit and use fluid -c . // ======================================================================= // // generated by Fast Light User Interface Designer (fluid) version 1.0402 #ifndef Fl_File_Chooser_H #define Fl_File_Chooser_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include class FL_EXPORT Fl_File_Chooser { public: /** \enum Type Determines the type of file chooser presented to the user. */ enum Type { SINGLE = 0, ///< Select a single, existing file. MULTI = 1, ///< Select one or more existing files. CREATE = 2, ///< When used alone, select a single, existing file or specify a new filename. ///< Can be combined with DIRECTORY (e.g. CREATE|DIRECTORY) to have the same ///< effect for directories. DIRECTORY = 4 ///< Select a single, existing directory. Can be combined with CREATE. }; private: static Fl_Preferences *prefs_; void (*callback_)(Fl_File_Chooser*, void *); void *data_; char directory_[FL_PATH_MAX]; char pattern_[FL_PATH_MAX]; char preview_text_[2048]; int type_; void favoritesButtonCB(); void favoritesCB(Fl_Widget *w); void fileListCB(); void fileNameCB(); void newdir(); static void previewCB(Fl_File_Chooser *fc); void showChoiceCB(); void update_favorites(); void update_preview(); public: Fl_File_Chooser(const char *pathname, const char *pattern, int type_val, const char *title); private: Fl_Double_Window *window; inline void cb_window_i(Fl_Double_Window*, void*); static void cb_window(Fl_Double_Window*, void*); Fl_Choice *showChoice; inline void cb_showChoice_i(Fl_Choice*, void*); static void cb_showChoice(Fl_Choice*, void*); Fl_Menu_Button *favoritesButton; inline void cb_favoritesButton_i(Fl_Menu_Button*, void*); static void cb_favoritesButton(Fl_Menu_Button*, void*); public: Fl_Button *newButton; private: inline void cb_newButton_i(Fl_Button*, void*); static void cb_newButton(Fl_Button*, void*); inline void cb__i(Fl_Tile*, void*); static void cb_(Fl_Tile*, void*); Fl_File_Browser *fileList; inline void cb_fileList_i(Fl_File_Browser*, void*); static void cb_fileList(Fl_File_Browser*, void*); Fl_Box *errorBox; Fl_Box *previewBox; public: Fl_Check_Button *previewButton; private: inline void cb_previewButton_i(Fl_Check_Button*, void*); static void cb_previewButton(Fl_Check_Button*, void*); public: Fl_Check_Button *showHiddenButton; private: inline void cb_showHiddenButton_i(Fl_Check_Button*, void*); static void cb_showHiddenButton(Fl_Check_Button*, void*); Fl_File_Input *fileName; inline void cb_fileName_i(Fl_File_Input*, void*); static void cb_fileName(Fl_File_Input*, void*); Fl_Return_Button *okButton; inline void cb_okButton_i(Fl_Return_Button*, void*); static void cb_okButton(Fl_Return_Button*, void*); Fl_Button *cancelButton; inline void cb_cancelButton_i(Fl_Button*, void*); static void cb_cancelButton(Fl_Button*, void*); Fl_Double_Window *favWindow; Fl_File_Browser *favList; inline void cb_favList_i(Fl_File_Browser*, void*); static void cb_favList(Fl_File_Browser*, void*); Fl_Button *favUpButton; inline void cb_favUpButton_i(Fl_Button*, void*); static void cb_favUpButton(Fl_Button*, void*); Fl_Button *favDeleteButton; inline void cb_favDeleteButton_i(Fl_Button*, void*); static void cb_favDeleteButton(Fl_Button*, void*); Fl_Button *favDownButton; inline void cb_favDownButton_i(Fl_Button*, void*); static void cb_favDownButton(Fl_Button*, void*); Fl_Button *favCancelButton; inline void cb_favCancelButton_i(Fl_Button*, void*); static void cb_favCancelButton(Fl_Button*, void*); Fl_Return_Button *favOkButton; inline void cb_favOkButton_i(Fl_Return_Button*, void*); static void cb_favOkButton(Fl_Return_Button*, void*); public: ~Fl_File_Chooser(); void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0); void color(Fl_Color c); Fl_Color color(); int count(); void directory(const char *d); char * directory(); void filter(const char *p); const char * filter(); int filter_value(); void filter_value(int f); void iconsize(uchar s); uchar iconsize(); void label(const char *l); const char * label(); void ok_label(const char *l); const char * ok_label(); void preview(int e); int preview() const { return previewButton->value(); } private: void showHidden(int e); void remove_hidden_files(); public: void rescan(); void rescan_keep_filename(); void show(); void hide(); int shown(); void textcolor(Fl_Color c); Fl_Color textcolor(); void textfont(Fl_Font f); Fl_Font textfont(); void textsize(Fl_Fontsize s); Fl_Fontsize textsize(); void type(int t); int type(); void * user_data() const; void user_data(void *d); const char *value(int f = 1); void value(const char *filename); int visible(); void position(int x, int y); int x() const; int y() const; int w() const; int h() const; void size(int w, int h); void resize(int x, int y, int w, int h); /** [standard text may be customized at run-time] */ static const char *add_favorites_label; /** [standard text may be customized at run-time] */ static const char *all_files_label; /** [standard text may be customized at run-time] */ static const char *custom_filter_label; /** [standard text may be customized at run-time] */ static const char *existing_file_label; /** [standard text may be customized at run-time] */ static const char *favorites_label; /** [standard text may be customized at run-time] */ static const char *filename_label; /** [standard text may be customized at run-time] */ static const char *filesystems_label; /** [standard text may be customized at run-time] */ static const char *manage_favorites_label; /** [standard text may be customized at run-time] */ static const char *new_directory_label; /** [standard text may be customized at run-time] */ static const char *new_directory_tooltip; /** [standard text may be customized at run-time] */ static const char *preview_label; /** [standard text may be customized at run-time] */ static const char *save_label; /** [standard text may be customized at run-time] */ static const char *show_label; /** [standard text may be customized at run-time] */ static const char *hidden_label; /** the sort function that is used when loading the contents of a directory. */ static Fl_File_Sort_F *sort; private: Fl_Widget* ext_group; public: Fl_Widget* add_extra(Fl_Widget* gr); protected: void show_error_box(int val); }; FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0); FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0); FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*)); FL_EXPORT void fl_file_chooser_ok_label(const char*l); #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_File_Icon.H ================================================ // // Fl_File_Icon definitions. // // Copyright 1999-2010 by Michael Sweet. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_File_Icon widget . */ // // Include necessary header files... // #ifndef _Fl_Fl_File_Icon_H_ # define _Fl_Fl_File_Icon_H_ # include "Fl.H" // // Special color value for the icon color. // # define FL_ICON_COLOR (Fl_Color)0xffffffff /**< icon color [background?]*/ // // Fl_File_Icon class... // /** The Fl_File_Icon class manages icon images that can be used as labels in other widgets and as icons in the FileBrowser widget. */ class FL_EXPORT Fl_File_Icon { //// Icon data static Fl_File_Icon *first_; // Pointer to first icon/filetype Fl_File_Icon *next_; // Pointer to next icon/filetype const char *pattern_; // Pattern string int type_; // Match only if directory or file? int num_data_; // Number of data elements int alloc_data_; // Number of allocated elements short *data_; // Icon data public: enum // File types { ANY, // Any kind of file PLAIN, // Only plain files FIFO, // Only named pipes DEVICE, // Only character and block devices LINK, // Only symbolic links DIRECTORY // Only directories }; enum // Data opcodes { END, // End of primitive/icon COLOR, // Followed by color value (2 shorts) LINE, // Start of line CLOSEDLINE, // Start of closed line POLYGON, // Start of polygon OUTLINEPOLYGON, // Followed by outline color (2 shorts) VERTEX // Followed by scaled X,Y }; Fl_File_Icon(const char *p, int t, int nd = 0, short *d = 0); ~Fl_File_Icon(); short *add(short d); /** Adds a color value to the icon array, returning a pointer to it. \param[in] c color value */ short *add_color(Fl_Color c) { short *d = add((short)COLOR); add((short)(c >> 16)); add((short)c); return (d); } /** Adds a vertex value to the icon array, returning a pointer to it. The integer version accepts coordinates from 0 to 10000. The origin (0.0) is in the lower-lefthand corner of the icon. \param[in] x, y vertex coordinates */ short *add_vertex(int x, int y) { short *d = add((short)VERTEX); add((short)x); add((short)y); return (d); } /** Adds a vertex value to the icon array, returning a pointer to it. The floating point version goes from 0.0 to 1.0. The origin (0.0) is in the lower-lefthand corner of the icon. \param[in] x, y vertex coordinates */ short *add_vertex(float x, float y) { short *d = add((short)VERTEX); add((short)(x * 10000.0)); add((short)(y * 10000.0)); return (d); } /** Clears all icon data from the icon.*/ void clear() { num_data_ = 0; } void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1); void label(Fl_Widget *w); static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a); void load(const char *f); int load_fti(const char *fti); int load_image(const char *i); /** Returns next file icon object. See Fl_File_Icon::first() */ Fl_File_Icon *next() { return (next_); } /** Returns the filename matching pattern for the icon.*/ const char *pattern() { return (pattern_); } /** Returns the number of words of data used by the icon.*/ int size() { return (num_data_); } /** Returns the filetype associated with the icon, which can be one of the following: \li Fl_File_Icon::ANY, any kind of file. \li Fl_File_Icon::PLAIN, plain files. \li Fl_File_Icon::FIFO, named pipes. \li Fl_File_Icon::DEVICE, character and block devices. \li Fl_File_Icon::LINK, symbolic links. \li Fl_File_Icon::DIRECTORY, directories. */ int type() { return (type_); } /** Returns the data array for the icon.*/ short *value() { return (data_); } static Fl_File_Icon *find(const char *filename, int filetype = ANY); /** Returns a pointer to the first icon in the list.*/ static Fl_File_Icon *first() { return (first_); } static void load_system_icons(void); }; #endif // !_Fl_Fl_File_Icon_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_File_Input.H ================================================ // // File_Input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // Original version Copyright 1998 by Curtis Edwards. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_File_Input widget . */ #ifndef Fl_File_Input_H # define Fl_File_Input_H # include /** \class Fl_File_Input \brief This widget displays a pathname in a text input field. A navigation bar located above the input field allows the user to navigate upward in the directory tree. You may want to handle FL_WHEN_CHANGED events for tracking text changes and also FL_WHEN_RELEASE for button release when changing to parent dir. FL_WHEN_RELEASE callback won't be called if the directory clicked is the same as the current one. \image html Fl_File_Input.png \image latex Fl_File_Input.png "Fl_File_Input" width=6cm \note As all Fl_Input derived objects, Fl_File_Input may call its callback when losing focus (see FL_UNFOCUS) to update its state like its cursor shape. One resulting side effect is that you should call clear_changed() early in your callback to avoid reentrant calls if you plan to show another window or dialog box in the callback. */ class FL_EXPORT Fl_File_Input : public Fl_Input { char ok_entry_; uchar down_box_; short buttons_[200]; short pressed_; void draw_buttons(); int handle_button(int event); void update_buttons(); public: Fl_File_Input(int X, int Y, int W, int H, const char *L=0); int handle(int event) FL_OVERRIDE; protected: void draw() FL_OVERRIDE; public: /** Gets the box type used for the navigation bar. */ Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; } /** Sets the box type to use for the navigation bar. */ void down_box(Fl_Boxtype b) { down_box_ = b; } /** Gets the current error color. Returns \p FL_RED since FLTK 1.4.0 (default in 1.3.x). Retained for backwards compatibility. \deprecated Will be removed in FLTK 1.5.0 or higher. \todo Remove Fl_File_Input::errorcolor() in FLTK 1.5.0 or higher. */ Fl_Color errorcolor() const { return FL_RED; } /** Sets the current error color to \p c. Does nothing since FLTK 1.4.0. Retained for backwards compatibility. \deprecated Will be removed in FLTK 1.5.0 or higher. \todo Remove Fl_File_Input::errorcolor(Fl_Color) in FLTK 1.5.0 or higher. */ void errorcolor(Fl_Color c) {(void)c;} int value(const char *str); int value(const char *str, int len); /** Returns the current value, which is a pointer to an internal buffer and is valid only until the next event is handled. */ const char *value() { return Fl_Input_::value(); } }; #endif // !Fl_File_Input_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Fill_Dial.H ================================================ // // Filled dial header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Fill_Dial widget . */ #ifndef Fl_Fill_Dial_H #define Fl_Fill_Dial_H #include "Fl_Dial.H" /** Draws a dial with a filled arc */ class FL_EXPORT Fl_Fill_Dial : public Fl_Dial { public: /** Creates a filled dial, also setting its type to FL_FILL_DIAL. */ Fl_Fill_Dial(int X,int Y,int W,int H, const char *L = NULL); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Fill_Slider.H ================================================ // // Filled slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Fill_Slider widget . */ #ifndef Fl_Fill_Slider_H #define Fl_Fill_Slider_H #include "Fl_Slider.H" /** Widget that draws a filled horizontal slider, useful as a progress or value meter*/ class FL_EXPORT Fl_Fill_Slider : public Fl_Slider { public: /** Creates the slider from its position,size and optional title. */ Fl_Fill_Slider(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Flex.H ================================================ // // Fl_Flex widget header file for the Fast Light Tool Kit (FLTK). // // Copyright 2020 by Karsten Pedersen // Copyright 2022-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Flex_H #define Fl_Flex_H #include /** Fl_Flex is a container (layout) widget for one row or one column of widgets. It provides flexible positioning of its children either in one row or in one column. Fl_Flex is designed to be as simple as possible. You can set individual widget sizes or let Fl_Flex position and size the widgets to fit in the container. All "flexible" (i.e. non-fixed size) widgets are assigned the same width or height, respectively. For details see below. You can set the margins \b around all children at the inner side of the box frame (if any). Fl_Flex supports setting different margin sizes on top, bottom, left, and right sides. The default margin size is 0 on all edges of the container. You can set the gap size \b between all children. The gap size is always the same between all of its children. This is similar to the 'spacing' of Fl_Pack. The default gap size is 0. Fl_Flex can either consist of a single row, i.e. \p type(Fl_Flex::HORIZONTAL) or a single column, i.e. \p type(Fl_Flex::VERTICAL). The default value is Fl_Flex::VERTICAL for consistency with Fl_Pack but you can use \p type() to assign a row (Fl_Flex::HORIZONTAL) layout. If type() == Fl_Flex::HORIZONTAL widgets are resized horizontally to fit in the container and their height is the full Fl_Flex height minus border size and margins. You can set a fixed widget width by using fixed(). If type() == Fl_Flex::VERTICAL widgets are resized vertically to fit in the container and their width is the full Fl_Flex width minus border size and margins. You can set a fixed widget height by using fixed(). To create arbitrary spacing you can use invisible boxes of flexible or fixed sizes (see example below). Alternate constructors let you specify the layout as Fl_Flex::HORIZONTAL or Fl_Flex::VERTICAL directly. Fl_Flex::ROW is an alias of Fl_Flex::HORIZONTAL and Fl_Flex::COLUMN is an alias of Fl_Flex::VERTICAL. The default box type is FL_NO_BOX as inherited from Fl_Group. You \b may need to set a box type with a solid background depending on your layout. \b Important: You should always make sure that the Fl_Flex container cannot be resized smaller than its designed minimal size. This can usually be done by setting a size_range() on the window as shown in the example below. Fl_Flex does not take care of sensible sizes. If it is resized too small the behavior is undefined, i.e. widgets may overlap and/or shrink to zero size. \b Hint: In many cases Fl_Flex can be used as a drop-in replacement for Fl_Pack. This is the recommended single row/column container since FLTK 1.4.0. Its resizing behavior is much more predictable than that of Fl_Pack which "resizes itself to shrink-wrap itself around all of the children". Fl_Flex containers can be nested so you can create flexible layouts with multiple columns and rows. However, if your UI design is more complex you may want to use Fl_Grid instead. Example: \image html Fl_Flex_simple.png \image latex Fl_Flex_simple.png "Fl_Flex" width=6cm Example code: \code #include #include #include #include #include int main(int argc, char **argv) { Fl_Double_Window window(410, 40, "Simple Fl_Flex Demo"); Fl_Flex flex(5, 5, 400, 30, Fl_Flex::HORIZONTAL); Fl_Button b1(0, 0, 0, 0, "File"); Fl_Button b2(0, 0, 0, 0, "Save"); Fl_Box bx(0, 0, 0, 0); Fl_Button b3(0, 0, 0, 0, "Exit"); flex.fixed(bx, 60); // set fix width of invisible box flex.gap(10); flex.end(); window.resizable(flex); window.end(); window.size_range(300, 30); window.show(argc, argv); return Fl::run(); } \endcode \since 1.4.0 */ class FL_EXPORT Fl_Flex : public Fl_Group { int margin_left_; // left margin int margin_top_; // top margin int margin_right_; // right margin int margin_bottom_; // bottom margin int gap_; // gap between widgets int fixed_size_size_; // number of fixed size widgets in array int fixed_size_alloc_; // allocated size of fixed size array Fl_Widget **fixed_size_; // array of fixed size widgets bool need_layout_; // true if layout needs to be calculated public: enum { // values for type(int) VERTICAL = 0, ///< vertical layout (one column) HORIZONTAL = 1, ///< horizontal layout (one row) COLUMN = 0, ///< alias for VERTICAL ROW = 1 ///< alias for HORIZONTAL }; // FLTK standard constructor Fl_Flex(int X, int Y, int W, int H, const char *L = 0); // original Fl_Flex constructors: // backwards compatible if direction enums { ROW | COLUMN } are used Fl_Flex(int direction); Fl_Flex(int w, int h, int direction); Fl_Flex(int x, int y, int w, int h, int direction); virtual ~Fl_Flex(); virtual void end(); void resize(int x, int y, int w, int h) FL_OVERRIDE; /** Set the horizontal or vertical size of a child widget. \param[in] w widget to be affected \param[in] size width (Fl_Flex::HORIZONTAL) or height (Fl_Flex::VERTICAL) \see fixed(Fl_Widget *w, int size) */ void fixed(Fl_Widget &w, int size) { fixed(&w, size); } void fixed(Fl_Widget *w, int size); int fixed(Fl_Widget *w) const; protected: void init(int t = VERTICAL); virtual int alloc_size(int size) const; void on_remove(int) FL_OVERRIDE; void draw() FL_OVERRIDE; public: /** Set or reset the request to calculate the layout of children. This is intended for internal use but can also be used by user code to request layout calculation before the widget is drawn. Call this if you changed attributes or sizes of children to ensure that the layout is calculated properly. Changing other Fl_Flex attributes or resizing the widget does this automatically. \note Never call this with '\c set == 0' because this would defeat its purpose to recalculate the layout before the widget is drawn. */ void need_layout(int set) { if (set) need_layout_ = true; else need_layout_ = false; } /** Returns whether layout calculation is required. This should rarely be needed by user code. Used internally in draw(). */ bool need_layout() const { return need_layout_; } /** Returns the left margin size of the widget. This returns the \b left margin of the widget which is not necessarily the same as all other margins. \note This method is useful if you never set different margin sizes. \see int margin(int *left, int *top, int *right, int *bottom) to get all four margin values. \return size of left margin. */ int margin() const { return margin_left_; } /** Returns all (four) margin sizes of the widget. All margin sizes are returned in the given arguments. If any argument is \p NULL the respective value is not returned. \param[in] left returns left margin if not \p NULL \param[in] top returns top margin if not \p NULL \param[in] right returns right margin if not \p NULL \param[in] bottom returns bottom margin if not \p NULL \return whether all margins are equal \retval 1 all margins have the same size \retval 0 at least one margin has a different size */ int margin(int *left, int *top, int *right, int *bottom) const { if (left) *left = margin_left_; if (top) *top = margin_top_; if (right) *right = margin_right_; if (bottom) *bottom = margin_bottom_; if (margin_left_ == margin_top_ && margin_top_ == margin_right_ && margin_right_ == margin_bottom_) return 1; return 0; } /** Set the margin and optionally the gap size of the widget. This method can be used to set both the margin and the gap size. If you don't use the second parameter \p g or supply a negative value the gap size is not changed. The margin is the free space inside the widget border \b around all child widgets. This method sets the margin to the same size at all four edges of the Fl_Flex widget. The gap size \p g is the free space \b between child widgets. Negative values do not change the gap value. This is the default if this argument is omitted. \param[in] m margin size, must be \>= 0 \param[in] g gap size (ignored, if negative) \see gap(int) */ void margin(int m, int g = -1) { if (m < 0) m = 0; margin_left_ = margin_top_ = margin_right_ = margin_bottom_ = m; if (g >= 0) gap_ = g; need_layout(1); } /** Set the margin sizes at all four edges of the Fl_Flex widget. The margin is the free space inside the widget border \b around all child widgets. You must use all four parameters of this method to set the four margins in the order \p left, \p top, \p right, \p bottom. Negative values are set to 0 (zero). To set all margins to equal sizes, use margin(int m) which sets all four margins to the same size. \param[in] left,top,right,bottom margin sizes, must be \>= 0 \see margin(int, int) */ void margin(int left, int top, int right, int bottom) { margin_left_ = left < 0 ? 0 : left; margin_top_ = top < 0 ? 0 : top; margin_right_ = right < 0 ? 0 : right; margin_bottom_ = bottom < 0 ? 0 : bottom; need_layout(1); } /** Return the gap size of the widget. \return gap size between all child widgets. */ int gap() const { return gap_; } /** Set the gap size of the widget. The gap size is some free space \b between child widgets. The size must be \>= 0. Negative values are clamped to 0. \param[in] g gap size */ void gap(int g) { gap_ = g < 0 ? 0 : g; need_layout(1); } /** Returns non-zero (true) if Fl_Flex alignment is horizontal (row mode). \returns non-zero if Fl_Flex alignment is horizontal \retval 1 if type() == Fl_Flex::HORIZONTAL \retval 0 if type() == Fl_Flex::VERTICAL See class Fl_Flex documentation for details. */ int horizontal() const { return type() == Fl_Flex::HORIZONTAL ? 1 : 0; } // Calculate the layout of the widget and redraw it. void layout(); /** Gets the number of extra pixels of blank space that are added between the children. This method is the same as 'int gap()' and is defined to enable using Fl_Flex as a drop-in replacement of Fl_Pack. \see int gap() */ int spacing() const { return gap_; } /** Sets the number of extra pixels of blank space that are added between the children. This method is the same as 'gap(int)' and is defined to enable using Fl_Flex as a drop-in replacement of Fl_Pack. \see void gap(int) */ void spacing(int i) { gap(i); need_layout(1); } }; #endif // Fl_Flex_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Float_Input.H ================================================ // // Floating point input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Float_Input widget . */ #ifndef Fl_Float_Input_H #define Fl_Float_Input_H #include "Fl_Input.H" /** The Fl_Float_Input class is a subclass of Fl_Input that only allows the user to type floating point numbers (sign, digits, decimal point, more digits, 'E' or 'e', sign, digits). */ class FL_EXPORT Fl_Float_Input : public Fl_Input { public: /** Creates a new Fl_Float_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_FormsBitmap.H ================================================ // // Forms bitmap header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_FormsBitmap widget . */ #ifndef Fl_FormsBitmap_H #define Fl_FormsBitmap_H #include "Fl_Bitmap.H" /** Forms compatibility Bitmap Image Widget */ class FL_EXPORT Fl_FormsBitmap : public Fl_Widget { Fl_Bitmap *b; protected: void draw() FL_OVERRIDE; public: Fl_FormsBitmap(Fl_Boxtype, int, int, int, int, const char * = 0); void set(int W, int H, const uchar *bits); /** Sets a new bitmap. */ void bitmap(Fl_Bitmap *B) {b = B;} /** Gets a the current associated Fl_Bitmap objects. */ Fl_Bitmap *bitmap() const {return b;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_FormsPixmap.H ================================================ // // Forms pixmap header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_FormsPixmap widget . */ #ifndef Fl_FormsPixmap_H #define Fl_FormsPixmap_H #include "Fl_Pixmap.H" /** \class Fl_FormsPixmap \brief Forms pixmap drawing routines */ class FL_EXPORT Fl_FormsPixmap : public Fl_Widget { Fl_Pixmap *b; protected: void draw() FL_OVERRIDE; public: Fl_FormsPixmap(Fl_Boxtype t, int X, int Y, int W, int H, const char *L= 0); void set(/*const*/char * const * bits); /** Set the internal pixmap pointer to an existing pixmap. \param[in] B existing pixmap */ void Pixmap(Fl_Pixmap *B) {b = B;} /** Get the internal pixmap pointer. */ Fl_Pixmap *Pixmap() const {return b;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Free.H ================================================ // // Forms free header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Free widget . */ #ifndef Fl_Free_H #define Fl_Free_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif #define FL_NORMAL_FREE 1 /**< normal event handling */ #define FL_SLEEPING_FREE 2 /**< deactivate event handling */ #define FL_INPUT_FREE 3 /**< accepts FL_FOCUS events */ #define FL_CONTINUOUS_FREE 4 /**< repeated timeout handling */ #define FL_ALL_FREE 5 /**< FL_INPUT_FREE and FL_CONTINOUS_FREE */ /** appropriate signature for handle function */ typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char); /** Emulation of the Forms "free" widget. This emulation allows the free demo to run, and appears to be useful for porting programs written in Forms which use the free widget or make subclasses of the Forms widgets. There are five types of free, which determine when the handle function is called: \li \c FL_NORMAL_FREE normal event handling. \li \c FL_SLEEPING_FREE deactivates event handling (widget is inactive). \li \c FL_INPUT_FREE accepts FL_FOCUS events. \li \c FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and provides an FL_STEP event. This has obvious detrimental effects on machine performance. \li \c FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE. */ class FL_EXPORT Fl_Free : public Fl_Widget { FL_HANDLEPTR hfunc; static void step(void *); protected: void draw() FL_OVERRIDE; public: int handle(int e) FL_OVERRIDE; Fl_Free(uchar t,int X,int Y,int W,int H,const char *L,FL_HANDLEPTR hdl); ~Fl_Free(); }; // old event names for compatibility: #define FL_MOUSE FL_DRAG /**< for backward compatibility */ #define FL_DRAW 100 /**< for backward compatibility [UNUSED]*/ #define FL_STEP 101 /**< for backward compatibility */ #define FL_FREEMEM 102 /**< for backward compatibility [UNUSED]*/ #define FL_FREEZE 103 /**< for backward compatibility [UNUSED]*/ #define FL_THAW 104 /**< for backward compatibility [UNUSED]*/ #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_GIF_Image.H ================================================ // // GIF image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_GIF_Image widget . */ #ifndef Fl_GIF_Image_H #define Fl_GIF_Image_H # include "Fl_Pixmap.H" /** The Fl_GIF_Image class supports loading, caching, and drawing of Compuserve GIFSM images. The class loads the first image and supports transparency. */ class FL_EXPORT Fl_GIF_Image : public Fl_Pixmap { public: Fl_GIF_Image(const char* filename); // deprecated constructor w/o length (for backwards compatibility) Fl_GIF_Image(const char* imagename, const unsigned char *data); // constructor with length (since 1.4.0) Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length); static bool is_animated(const char *name_); /** Sets how the shared image core routine should treat animated GIF files. The default is to treat them as ordinary GIF's e.g. it creates a Fl_GIF_Image object. If this variable is set, then an animated GIF object Fl_Anim_GIF_Image is created. */ static bool animate; protected: // Protected constructors needed for animated GIF support through Fl_Anim_GIF_Image. Fl_GIF_Image(const char* filename, bool anim); Fl_GIF_Image(const char* imagename, const unsigned char *data, const size_t length, bool anim); // Protected default constructor needed for Fl_Anim_GIF_Image. Fl_GIF_Image(); void load_gif_(class Fl_Image_Reader &rdr, bool anim=false); void load(const char* filename, bool anim); void load(const char* imagename, const unsigned char *data, const size_t length, bool anim); // Internal structure to "glue" animated GIF support into Fl_GIF_Image. // This data is passed during decoding to the Fl_Anim_GIF_Image class. struct GIF_FRAME { int ifrm, width, height, x, y, w, h, clrs, bkgd, trans, dispose, delay; const uchar *bptr; const struct CPAL { uchar r, g, b; } *cpal; GIF_FRAME(int frame, uchar *data) : ifrm(frame), bptr(data) {} GIF_FRAME(int frame, int W, int H, int fx, int fy, int fw, int fh, uchar *data) : ifrm(frame), width(W), height(H), x(fx), y(fy), w(fw), h(fh), bptr(data) {} void disposal(int mode, int time) { dispose = mode; this->delay = time; } void colors(int nclrs, int bg, int tp) { clrs = nclrs; bkgd = bg; trans = tp; } }; // Internal virtual methods, which are called during decoding to pass data // to the Fl_Anim_GIF_Image class. virtual void on_frame_data(GIF_FRAME &) {} virtual void on_extension_data(GIF_FRAME &) {} private: void lzw_decode(Fl_Image_Reader &rdr, uchar *Image, int Width, int Height, int CodeSize, int ColorMapSize, int Interlace); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Gl_Window.H ================================================ // // OpenGL header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Gl_Window widget . */ #ifndef Fl_Gl_Window_H #define Fl_Gl_Window_H #include "Fl_Window.H" class Fl_Gl_Choice; // structure to hold result of glXChooseVisual class Fl_Gl_Window_Driver; /** The Fl_Gl_Window widget sets things up so OpenGL works. It also keeps an OpenGL "context" for that window, so that changes to the lighting and projection may be reused between redraws. Fl_Gl_Window also flushes the OpenGL streams and swaps buffers after draw() returns. OpenGL hardware typically provides some overlay bit planes, which are very useful for drawing UI controls atop your 3D graphics. If the overlay hardware is not provided, FLTK tries to simulate the overlay. This works pretty well if your graphics are double buffered, but not very well for single-buffered. Please note that the FLTK drawing and clipping functions will not work inside an Fl_Gl_Window. All drawing should be done using OpenGL calls exclusively. \see \ref opengl_highdpi \note FLTK 1.4 introduces a driver system for graphic calls. It is now possible to add a selection of widgets to an OpenGL window. The widgets will draw on top of any OpenGL rendering. The number of supported widgets will increase as the driver development improves. Program test/cube.cxx illustrates how to do that. \note FLTK expects that when an Fl_Gl_Window is a child of a parent Fl_Window, the child window lies entirely inside its parent window. If that's not the case, what happens to the part of the GL subwindow which leaks outside its parent is undefined and susceptible to be platform-specific. */ class FL_EXPORT Fl_Gl_Window : public Fl_Window { friend class Fl_Gl_Window_Driver; Fl_Gl_Window_Driver *pGlWindowDriver; int mode_; const int *alist; Fl_Gl_Choice *g; GLContext context_; char valid_f_; char damage1_; // damage() of back buffer virtual void draw_overlay(); void init(); void *overlay; static int can_do(int, const int *); int mode(int, const int *); static int gl_plugin_linkage(); protected: void draw_begin(); void draw() FL_OVERRIDE; void draw_end(); public: void show() FL_OVERRIDE; /** Same as Fl_Window::show(int a, char **b) */ void show(int a, char **b) {Fl_Window::show(a,b);} void flush() FL_OVERRIDE; void hide() FL_OVERRIDE; void resize(int,int,int,int) FL_OVERRIDE; int handle(int) FL_OVERRIDE; /** Is turned off when FLTK creates a new context for this window or when the window resizes, and is turned on \e after draw() is called. You can use this inside your draw() method to avoid unnecessarily initializing the OpenGL context. Just do this: \code void mywindow::draw() { if (!valid()) { glViewport(0,0,pixel_w(),pixel_h()); glFrustum(...); ...other initialization... } if (!context_valid()) { ...load textures, etc. ... } ... draw your geometry here ... } \endcode You can turn valid() on by calling valid(1). You should only do this after fixing the transformation inside a draw() or after make_current(). This is done automatically after draw() returns. */ char valid() const {return valid_f_ & 1;} /** See char Fl_Gl_Window::valid() const */ void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;} void invalidate(); /** Will only be set if the OpenGL context is created or recreated. It differs from Fl_Gl_Window::valid() which is also set whenever the context changes size. */ char context_valid() const {return valid_f_ & 2;} /** See char Fl_Gl_Window::context_valid() const */ void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;} /** Returns non-zero if the hardware supports the given OpenGL mode. */ static int can_do(int m) {return can_do(m,0);} /** Returns non-zero if the hardware supports the given OpenGL mode. \see Fl_Gl_Window::mode(const int *a) */ static int can_do(const int *m) {return can_do(0, m);} /** Returns non-zero if the hardware supports the current OpenGL mode. */ int can_do() {return can_do(mode_,alist);} /** Returns the current OpenGL capabilities of the window. Don't use this if capabilities were set through Fl_Gl_Window::mode(const int *a). */ Fl_Mode mode() const {return (Fl_Mode)mode_;} /** Set or change the OpenGL capabilities of the window. The value can be any of the following OR'd together: - \c FL_RGB - RGB color (not indexed) - \c FL_RGB8 - RGB color with at least 8 bits of each color - \c FL_INDEX - Indexed mode - \c FL_SINGLE - not double buffered - \c FL_DOUBLE - double buffered - \c FL_ACCUM - accumulation buffer - \c FL_ALPHA - alpha channel in color - \c FL_DEPTH - depth buffer - \c FL_STENCIL - stencil buffer - \c FL_MULTISAMPLE - multisample antialiasing - \c FL_OPENGL3 - use OpenGL version 3.0 or more. FL_RGB and FL_SINGLE have a value of zero, so they are "on" unless you give FL_INDEX or FL_DOUBLE. If the desired combination cannot be done, FLTK will try turning off FL_MULTISAMPLE. If this also fails the show() will call Fl::error() and not show the window. You can change the mode while the window is displayed. This is most useful for turning double-buffering on and off. Under X this will cause the old X window to be destroyed and a new one to be created. If this is a top-level window this will unfortunately also cause the window to blink, raise to the top, and be de-iconized, and the xid() will change, possibly breaking other code. It is best to make the GL window a child of another window if you wish to do this! mode() must not be called within draw() since it changes the current context. The FL_OPENGL3 flag is recommended to use OpenGL version 3 or more. This flag is required (not just recommended) if GL ≥ 3.0 is in use and at least one of these conditions applies: - the program runs on the macOS platform; - the Fl_Gl_Window has child widgets. See more details in \ref opengl3. \version the FL_OPENGL3 flag appeared in version 1.3.4 */ int mode(int a) {return mode(a,0);} /** Set the OpenGL capabilities of the window using platform-specific data. \param a zero-ending array of platform-specific attributes and attribute values

Unix/Linux platform: attributes are GLX attributes adequate for the 3rd argument of the glXChooseVisual() function (e.g., GLX_DOUBLEBUFFER, defined by including ). \note What attributes are adequate here is subject to change. The preferred, stable public API is Fl_Gl_Window::mode(int a).

Windows platform: this member function is of no use.

Mac OS X platform: attributes belong to the CGLPixelFormatAttribute enumeration (defined by including , e.g., kCGLPFADoubleBuffer) and may be followed by adequate attribute values. */ int mode(const int *a) {return mode(0, a);} /** Returns a pointer to the window's OpenGL rendering context. \see void context(GLContext c, int destroy_flag) */ GLContext context() const {return context_;} void context(GLContext, int destroy_flag = 0); void make_current(); void swap_buffers(); void swap_interval(int); int swap_interval() const; void ortho(); int can_do_overlay(); void redraw_overlay(); void hide_overlay(); void make_overlay_current(); // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. Fl_Gl_Window* as_gl_window() FL_OVERRIDE { return this; } Fl_Gl_Window const* as_gl_window() const FL_OVERRIDE { return this; } float pixels_per_unit(); /** Gives the window width in OpenGL pixels. When an Fl_Gl_Window is mapped to a HighDPI display, the value given by Fl_Gl_Window::w() which is expressed in FLTK units, may differ from the window width in pixels. Calls to OpenGL functions expecting pixel values (\em e.g., \c glViewport) should therefore use pixel_w() rather than w(). Method pixel_w() detects when the GUI is rescaled or when the window has been moved between low and high resolution displays and automatically adjusts the returned value. \version 1.3.4 */ int pixel_w() { return int(pixels_per_unit() * w() + 0.5f); } /** Gives the window height in OpenGL pixels. When an Fl_Gl_Window is mapped to a HighDPI display, the value given by Fl_Gl_Window::h() which is expressed in FLTK units, may differ from the window height in pixels. Calls to OpenGL functions expecting pixel values (\em e.g., \c glViewport) should therefore use pixel_h() rather than h(). Method pixel_h() detects when the GUI is rescaled or when the window has been moved between low and high resolution displays and automatically adjusts the returned value. \version 1.3.4 */ int pixel_h() { return int(pixels_per_unit() * h() + 0.5f); } ~Fl_Gl_Window(); /** Creates a new Fl_Gl_Window widget using the given size, and label string. The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH. */ Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();} /** Creates a new Fl_Gl_Window widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH. */ Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0) : Fl_Window(X,Y,W,H,l) {init();} }; #endif // Fl_Gl_Window_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Graphics_Driver.H ================================================ // // Declaration of classes Fl_Graphics_Driver, Fl_Scalable_Graphics_Driver, // and Fl_Font_Descriptor for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \cond DriverDev \addtogroup DriverDeveloper \{ */ /** \file Fl_Graphics_Driver.H \brief Declaration of class Fl_Graphics_Driver. */ #ifndef FL_GRAPHICS_DRIVER_H #define FL_GRAPHICS_DRIVER_H #include #include #include #include #include class Fl_Graphics_Driver; class Fl_Font_Descriptor; class Fl_Image_Surface; FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver; /** signature of image generation callback function. \param[in] data user data passed to function \param[in] x,y,w position and width of scan line in image \param[out] buf buffer for generated image data. You must copy \p w pixels from scanline \p y, starting at pixel \p x to this buffer. */ typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf); struct Fl_Fontdesc; typedef struct _PangoFontDescription PangoFontDescription; // FIXME: The following constants are deprecated and will be removed in FLTK 1.5.0 // in favor of dynamic clipping stack allocation. This needs C++11 features. // See issue #1139: "FL_REGION_STACK_SIZE could be increased" // and issue #1140: "Fix static array allocation". #if FL_ABI_VERSION >= 10401 # define FL_REGION_STACK_SIZE 64 #else # define FL_REGION_STACK_SIZE 10 #endif #define FL_MATRIX_STACK_SIZE 32 /** An abstract class subclassed for each graphics driver FLTK uses. Typically, FLTK applications do not use directly objects from this class. Rather, they perform drawing operations (e.g., fl_rectf()) that operate on the current drawing surface (see Fl_Surface_Device). Drawing operations are functionally presented in \ref drawing and as function lists in the \ref fl_drawings and \ref fl_attributes modules. Fl_Surface_Device::surface()->driver() gives at any time the graphics driver used by all drawing operations. For compatibility with older FLTK versions, the \ref fl_graphics_driver global variable gives the same result. Its value changes when drawing operations are directed to another drawing surface by Fl_Surface_Device::push_current() / Fl_Surface_Device::pop_current() / Fl_Surface_Device::set_current(). The Fl_Graphics_Driver class is essential for developers of the FLTK library. Each platform supported by FLTK requires to create a derived class of Fl_Graphics_Driver that implements all its virtual member functions according to the platform. */ class FL_EXPORT Fl_Graphics_Driver { friend class Fl_Surface_Device; friend class Fl_Pixmap; friend class Fl_Bitmap; friend class Fl_RGB_Image; friend class Fl_SVG_Image; friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L); friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L); friend void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D); friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D); friend void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy); friend int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg); friend FL_EXPORT int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg); friend FL_EXPORT void gl_start(); /* ============== Implementation note about image drawing ========================= A graphics driver can implement up to 6 virtual member functions to draw images: virtual void draw_pixmap(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy) virtual void draw_bitmap(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy) virtual void draw_rgb(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, int cy) and virtual void draw_fixed(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy) virtual void draw_fixed(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy) virtual void draw_fixed(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, int cy) - The 1st group of functions is used when the driver can directly map the image data, sized at data_w() x data_h(), to the image drawing area, sized at w()*scale x h()*scale where scale is the current GUI scale factor. - If the driver does not support such scale-and-draw operation for a given image type, it should implement the draw_fixed() function which is called by the library after the image has been internally resized to the drawing size and cached. - The platform-independent Fl_Graphics_Driver class implements the 1st group of functions. Each resizes the image, caches it, and calls the platform-specific implementation of draw_fixed(image-class *,....) with the cached image. - Consider an image object, say from class Fl_RGB_Image. Fl_RGB_Image::draw() calls the virtual member function draw_rgb(Fl_RGB_Image *,....). If Fl_XXX_Graphics_Driver re-implements this function, this code runs and is expected to draw the image adequately scaled to its drawing size. If Fl_XXX_Graphics_Driver does not re-implement this function, Fl_Graphics_Driver::draw_rgb(Fl_RGB_Image *,....) runs. It internally resizes the image, caches it, and calls Fl_XXX_Graphics_Driver::draw_fixed(Fl_RGB_Image *,....) that draws the image from its cached form which already has the adequate size. - Some drivers implement, for a given image class, only the function of the 1st group or only draw_fixed() as in these examples: - Fl_Quartz_Graphics_Driver implements only draw_rgb(Fl_RGB_Image *,....) because it can perform the scale-and-draw operation whatever the RGB image and the required scaling. - Fl_Xlib_Graphics_Driver implements only draw_fixed(Fl_Pixmap *,....). The library takes care of resizing and caching the Pixmap to the adequate drawing size. - Some drivers implement, for a given image class, the function of both groups, e.g. : Fl_GDI_Graphics_Driver implements both draw_rgb(Fl_RGB_Image *,....) and draw_fixed(Fl_RGB_Image *,....) because scale-and-draw may require function Alphablend() from MSIMG32.DLL. In the absence of that, the draw_rgb() implementation calls Fl_Graphics_Driver::draw_rgb() which runs Fl_GDI_Graphics_Driver::draw_fixed(Fl_RGB_Image*,...). Graphics drivers also implement cache(Fl_Pixmap*), cache(Fl_Bitmap*) and cache(Fl_RGB_Image*) to compute the cached form of all image types, and uncache(Fl_RGB_Image *,...), uncache_pixmap(fl_uintptr_t) and delete_bitmask(fl_uintptr_t) to destroy cached image forms. Graphics drivers that use the mask_ variable of class Fl_Pixmap to cache an Fl_Pixmap object also reimplement the uchar **Fl_Graphics_Driver::mask_bitmap() member function. */ private: virtual void draw_fixed(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy); virtual void draw_fixed(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy); virtual void draw_fixed(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, int cy); // the default implementation of make_unused_color_() is most probably enough virtual void make_unused_color_(unsigned char &r, unsigned char &g, unsigned char &b, int color_count, void **data); // some platforms may need to reimplement this virtual void set_current_(); void draw_image_general_(const uchar *buf, int X, int Y, int W, int H, int D, int L); void draw_image_mono_general_(const uchar *buf, int X, int Y, int W, int H, int D, int L); float scale_; // scale between FLTK and drawing coordinates: drawing = FLTK * scale_ public: /** Creates the graphics driver that is used for core operations. */ static Fl_Graphics_Driver *newMainGraphicsDriver(); /** A 2D coordinate transformation matrix */ struct matrix {double a, b, c, d, x, y;}; /** Features that a derived class may possess. */ typedef enum { NATIVE = 1, /**< native graphics driver for the platform */ PRINTER = 2 /**< graphics driver for a printer drawing surface */ } driver_feature; protected: int fl_clip_state_number; ///< For internal use by FLTK static const matrix m0; ///< For internal use by FLTK Fl_Font font_; ///< current font Fl_Fontsize size_; ///< current font size Fl_Color color_; ///< current color int sptr;///< For internal use by FLTK static const int matrix_stack_size = FL_MATRIX_STACK_SIZE; ///< For internal use by FLTK matrix stack[FL_MATRIX_STACK_SIZE]; ///< For internal use by FLTK matrix m; ///< current transformation matrix int n; ///< For internal use by FLTK int gap_; ///< For internal use by FLTK enum SHAPE {NONE=0, LINE, LOOP, POLYGON, POINTS, COMPLEX_POLYGON} what; int rstackptr; ///< For internal use by FLTK static const int region_stack_max = FL_REGION_STACK_SIZE - 1; ///< For internal use by FLTK Fl_Region rstack[FL_REGION_STACK_SIZE]; ///< For internal use by FLTK Fl_Font_Descriptor *font_descriptor_; ///< For internal use by FLTK int p_size; typedef struct { float x; float y; } XPOINT; XPOINT *xpoint; virtual void global_gc(); virtual void cache(Fl_Pixmap *img); virtual void cache(Fl_Bitmap *img); virtual void cache(Fl_RGB_Image *img); virtual void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_); // --- implementation is in src/drivers/xxx/Fl_xxx_Graphics_Driver_image.cxx virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); virtual void draw_rgb(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy); virtual void draw_pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy); virtual void draw_bitmap(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy); virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy); /** For internal library use only */ static void change_image_size(Fl_Image *img, int W, int H) { img->w(W); img->h(H); } // Support function for image drawing virtual void uncache_pixmap(fl_uintptr_t p); // accessor functions to protected image members int start_image(Fl_Image *img, int XP, int YP, int WP, int HP, int &cx, int &cy, int &X, int &Y, int &W, int &H); /** Accessor to a private member variable of Fl_RGB_Image */ static fl_uintptr_t* id(Fl_RGB_Image *rgb) {return &(rgb->id_);} /** Accessor to a private member variable of Fl_Pixmap */ static fl_uintptr_t* id(Fl_Pixmap *pm) {return &(pm->id_);} /** Accessor to a private member variable of Fl_Bitmap */ static fl_uintptr_t* id(Fl_Bitmap *bm) {return &(bm->id_);} /** Accessor to a private member variable of Fl_RGB_Image */ static fl_uintptr_t* mask(Fl_RGB_Image *rgb) {return &(rgb->mask_);} /** Accessor to a private member variable of Fl_Pixmap */ static fl_uintptr_t* mask(Fl_Pixmap *pm) {return &(pm->mask_);} /** Accessor to private member variables of Fl_Pixmap */ static void cache_w_h(Fl_Pixmap *pm, int*& pwidth, int*& pheight) { pwidth = &(pm->cache_w_); pheight = &(pm->cache_h_); } /** Accessor to private member variables of Fl_Bitmap */ static void cache_w_h(Fl_Bitmap *bm, int*& pwidth, int*& pheight) { pwidth = &(bm->cache_w_); pheight = &(bm->cache_h_); } /** Accessor to private member variables of Fl_RGB_Image */ static void cache_w_h(Fl_RGB_Image *rgb, int*& pwidth, int*& pheight) { pwidth = &(rgb->cache_w_); pheight = &(rgb->cache_h_); } static Fl_Offscreen get_offscreen_and_delete_image_surface(Fl_Image_Surface*); /** For internal library use only */ static void draw_empty(Fl_Image* img, int X, int Y) {img->draw_empty(X, Y);} Fl_Graphics_Driver(); virtual void cache_size(Fl_Image *img, int &width, int &height); void cache_size_finalize(Fl_Image *img, int &width, int &height); static unsigned need_pixmap_bg_color; public: virtual ~Fl_Graphics_Driver(); static Fl_Graphics_Driver &default_driver(); // support of "complex shapes" void push_matrix(); void pop_matrix(); void load_identity(); void load_matrix(double a, double b, double c, double d, double x, double y); void mult_matrix(double a, double b, double c, double d, double x, double y); void rotate(double d); void translate(double x,double y); double transform_x(double x, double y); double transform_y(double x, double y); double transform_dx(double x, double y); double transform_dy(double x, double y); /** Return the current Fl_Font_Descriptor */ inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;} /** Set the current Fl_Font_Descriptor */ inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;} /** Current scale factor between FLTK and drawing units: drawing = FLTK * scale() */ float scale() { return scale_; } /** Sets the current value of the scaling factor */ virtual void scale(float f); /** Return whether the graphics driver can do alpha blending */ virtual char can_do_alpha_blending(); virtual void point(int x, int y); virtual void rect(int x, int y, int w, int h); virtual void focus_rect(int x, int y, int w, int h); virtual void rectf(int x, int y, int w, int h); virtual void _rbox(int fill, int x, int y, int w, int h, int r); virtual void rounded_rect(int x, int y, int w, int h, int r); virtual void rounded_rectf(int x, int y, int w, int h, int r); // the default implementation is most likely enough virtual void colored_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b); virtual void line(int x, int y, int x1, int y1); /** see fl_line(int, int, int, int, int, int) */ virtual void line(int x, int y, int x1, int y1, int x2, int y2); /** see fl_xyline(int, int, int) */ virtual void xyline(int x, int y, int x1); /** see fl_xyline(int, int, int, int) */ virtual void xyline(int x, int y, int x1, int y2); /** see fl_xyline(int, int, int, int, int) */ virtual void xyline(int x, int y, int x1, int y2, int x3); /** see fl_yxline(int, int, int) */ virtual void yxline(int x, int y, int y1); /** see fl_yxline(int, int, int, int) */ virtual void yxline(int x, int y, int y1, int x2); /** see fl_yxline(int, int, int, int, int) */ virtual void yxline(int x, int y, int y1, int x2, int y3); /** see fl_loop(int, int, int, int, int, int) */ virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2); /** see fl_loop(int, int, int, int, int, int, int, int) */ virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2); /** see fl_polygon(int, int, int, int, int, int, int, int) */ virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); // --- clipping virtual void push_clip(int x, int y, int w, int h); virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); virtual int not_clipped(int x, int y, int w, int h); /** see fl_push_no_clip() */ virtual void push_no_clip(); // has default implementation /** see fl_pop_clip() */ virtual void pop_clip(); // has default implementation virtual Fl_Region clip_region(); // has default implementation virtual void clip_region(Fl_Region r); // has default implementation virtual void restore_clip(); virtual void begin_points(); virtual void begin_line(); virtual void begin_loop(); virtual void begin_polygon(); virtual void begin_complex_polygon(); virtual void transformed_vertex(double xf, double yf); virtual void transformed_vertex0(float x, float y); virtual void vertex(double x, double y); virtual void end_points(); virtual void end_line(); virtual void end_loop(); virtual void fixloop(); virtual void end_polygon(); virtual void end_complex_polygon(); // default implementation is most probably enough virtual bool can_fill_non_convex_polygon() { return true; } virtual void gap(); virtual void circle(double x, double y, double r); virtual void arc(double x, double y, double r, double start, double end); virtual void arc(int x, int y, int w, int h, double a1, double a2); virtual void pie(int x, int y, int w, int h, double a1, double a2); // To support fl_draw_circle(int x, int y, int d, Fl_Color color), // the default implementation is most probably enough. virtual void draw_circle(int x, int y, int d, Fl_Color c); virtual void curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3); virtual void line_style(int style, int width=0, char* dashes=0); virtual void color(Fl_Color c); virtual void set_color(Fl_Color i, unsigned int c); virtual void free_color(Fl_Color i, int overlay); virtual Fl_Color color(); virtual void color(uchar r, uchar g, uchar b); virtual void draw(const char *str, int nChars, int x, int y); virtual void draw(const char *str, int nChars, float x, float y); virtual void draw(int angle, const char *str, int nChars, int x, int y); virtual void rtl_draw(const char *str, int nChars, int x, int y); virtual int has_feature(driver_feature feature); virtual void font(Fl_Font face, Fl_Fontsize fsize); virtual Fl_Font font(); virtual Fl_Fontsize size(); virtual double width(const char *str, int nChars); virtual double width(unsigned int c); virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); virtual int height(); virtual int descent(); virtual void gc(void*); virtual void *gc(void); virtual uchar **mask_bitmap(); // default implementation may be enough virtual float scale_font_for_PostScript(Fl_Font_Descriptor *desc, int s); // default implementation may be enough virtual float scale_bitmap_for_PostScript(); // each platform implements these 3 functions its own way virtual void add_rectangle_to_region(Fl_Region r, int x, int y, int w, int h); virtual Fl_Region XRectangleRegion(int x, int y, int w, int h); virtual void XDestroyRegion(Fl_Region r); virtual const char* get_font_name(Fl_Font fnum, int* ap); virtual int get_font_sizes(Fl_Font fnum, int*& sizep); virtual Fl_Font set_fonts(const char *name); virtual Fl_Fontdesc* calc_fl_fonts(void); virtual unsigned font_desc_size(); virtual const char *font_name(int num); virtual void font_name(int num, const char *name); // Defaut implementation may be enough virtual void overlay_rect(int x, int y, int w , int h); virtual float override_scale(); virtual void restore_scale(float); virtual PangoFontDescription* pango_font_description() { return NULL; } virtual void antialias(int state); virtual int antialias(); virtual void delete_bitmask(fl_uintptr_t bm); }; #ifndef FL_DOXYGEN /* This class is not part of FLTK's public API. Platforms usually define a derived class called Fl_XXX_Font_Descriptor containing extra platform-specific data/functions. This is a class for an actual system font, with junk to help choose it and info on character sizes. Each Fl_Fontdesc has a linked list of these. These are created the first time each system font/size combination is used. */ class Fl_Font_Descriptor { public: /** linked list for this Fl_Fontdesc */ Fl_Font_Descriptor *next; Fl_Fontsize size; /**< font size */ Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); virtual FL_EXPORT ~Fl_Font_Descriptor() {} int ascent, descent; unsigned int listbase;// base of display list, 0 = none }; // This struct is not part of FLTK's public API. struct Fl_Fontdesc { const char *name; char fontname[128]; // "Pretty" font name Fl_Font_Descriptor *first; // linked list of sizes of this style }; /* Abstract class Fl_Scalable_Graphics_Driver is platform-independent. It supports the scaling of all graphics coordinates by a float factor helpful to support HiDPI displays. This class does : - compute scaled coordinates - scale the cached offscreen of image objects - scale the pixel arrays used when performing direct image draws - call the member functions of a platform-specific, Fl_Scalable_Graphics_Driver-derived class that do the drawings with adequately scaled coordinates. The member functions are named with the _unscaled suffix. - scale and unscale the clipping region. This class is presently used by the X11 and Windows platforms to support HiDPI displays. In the future, it may also be used by other platforms. */ class FL_EXPORT Fl_Scalable_Graphics_Driver : public Fl_Graphics_Driver { Fl_Fontsize fontsize_; // scale-independent font size value public: Fl_Scalable_Graphics_Driver(); static int floor(int x, float s); inline int floor(int x) { return Fl_Scalable_Graphics_Driver::floor(x, scale()); } protected: int line_width_; virtual Fl_Region scale_clip(float f); void unscale_clip(Fl_Region r); void point(int x, int y) FL_OVERRIDE; virtual void point_unscaled(float x, float y); void rect(int x, int y, int w, int h) FL_OVERRIDE; void rectf(int x, int y, int w, int h) FL_OVERRIDE; virtual void rect_unscaled(int x, int y, int w, int h); virtual void rectf_unscaled(int x, int y, int w, int h); void line(int x, int y, int x1, int y1) FL_OVERRIDE; virtual void line_unscaled(int x, int y, int x1, int y1); void line(int x, int y, int x1, int y1, int x2, int y2) FL_OVERRIDE; virtual void line_unscaled(int x, int y, int x1, int y1, int x2, int y2); void xyline(int x, int y, int x1) FL_OVERRIDE; virtual void xyline_unscaled(int x, int y, int x1); void xyline(int x, int y, int x1, int y2) FL_OVERRIDE {Fl_Graphics_Driver::xyline(x, y, x1, y2);} void xyline(int x, int y, int x1, int y2, int x3) FL_OVERRIDE {Fl_Graphics_Driver::xyline(x, y, x1, y2, x3);} void yxline(int x, int y, int y1) FL_OVERRIDE; virtual void yxline_unscaled(int x, int y, int y1); void yxline(int x, int y, int y1, int x2) FL_OVERRIDE {Fl_Graphics_Driver::yxline(x, y, y1, x2);} void yxline(int x, int y, int y1, int x2, int y3) FL_OVERRIDE {Fl_Graphics_Driver::yxline(x, y, y1, x2, y3);} void loop(int x0, int y0, int x1, int y1, int x2, int y2) FL_OVERRIDE; virtual void loop_unscaled(int x0, int y0, int x1, int y1, int x2, int y2); void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) FL_OVERRIDE; virtual void loop_unscaled(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); void polygon(int x0, int y0, int x1, int y1, int x2, int y2) FL_OVERRIDE; virtual void polygon_unscaled(int x0, int y0, int x1, int y1, int x2, int y2); void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) FL_OVERRIDE; virtual void polygon_unscaled(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); void circle(double x, double y, double r) FL_OVERRIDE; virtual void ellipse_unscaled(double xt, double yt, double rx, double ry); void font(Fl_Font face, Fl_Fontsize size) FL_OVERRIDE; Fl_Font font() FL_OVERRIDE; virtual void font_unscaled(Fl_Font face, Fl_Fontsize size); double width(const char *str, int n) FL_OVERRIDE; double width(unsigned int c) FL_OVERRIDE; virtual double width_unscaled(const char *str, int n); virtual double width_unscaled(unsigned int c); Fl_Fontsize size() FL_OVERRIDE; virtual Fl_Fontsize size_unscaled(); void text_extents(const char *str, int n, int &dx, int &dy, int &w, int &h) FL_OVERRIDE; virtual void text_extents_unscaled(const char *str, int n, int &dx, int &dy, int &w, int &h); int height() FL_OVERRIDE; int descent() FL_OVERRIDE; virtual int height_unscaled(); virtual int descent_unscaled(); void draw(const char *str, int n, int x, int y) FL_OVERRIDE; virtual void draw_unscaled(const char *str, int n, int x, int y); void draw(int angle, const char *str, int n, int x, int y) FL_OVERRIDE; virtual void draw_unscaled(int angle, const char *str, int n, int x, int y); void draw(const char *str, int nChars, float x, float y) FL_OVERRIDE; void rtl_draw(const char* str, int n, int x, int y) FL_OVERRIDE; virtual void rtl_draw_unscaled(const char* str, int n, int x, int y); void arc(double x, double y, double r, double start, double end) FL_OVERRIDE; void arc(int x, int y, int w, int h, double a1, double a2) FL_OVERRIDE; virtual void arc_unscaled(int x, int y, int w, int h, double a1, double a2); void pie(int x, int y, int w, int h, double a1, double a2) FL_OVERRIDE; virtual void pie_unscaled(int x, int y, int w, int h, double a1, double a2); void draw_circle(int x, int y, int d, Fl_Color c) FL_OVERRIDE; void line_style(int style, int width=0, char* dashes=0) FL_OVERRIDE; virtual void line_style_unscaled(int style, int width, char* dashes); void draw_image_rescale(void *buf, Fl_Draw_Image_Cb cb, int X, int Y, int W, int H, int D, int L, bool mono); virtual void draw_image_unscaled(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); virtual void draw_image_unscaled(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) FL_OVERRIDE; void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) FL_OVERRIDE; virtual void draw_image_mono_unscaled(const uchar* buf, int x, int y, int w, int h, int d, int l); void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) FL_OVERRIDE; virtual void draw_image_mono_unscaled(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) FL_OVERRIDE; void transformed_vertex(double xf, double yf) FL_OVERRIDE; void vertex(double x, double y) FL_OVERRIDE; float override_scale() FL_OVERRIDE; void restore_scale(float) FL_OVERRIDE; virtual void *change_pen_width(int lwidth); virtual void reset_pen_width(void *data); }; #endif // FL_DOXYGEN #endif // FL_GRAPHICS_DRIVER_H /** \} \endcond */ ================================================ FILE: Game Trainers/common/include/FL/Fl_Grid.H ================================================ // // Fl_Grid widget header for the Fast Light Tool Kit (FLTK). // // Copyright 2021-2022 by Albrecht Schlosser. // Copyright 2022-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef _FL_FL_GRID_H_ #define _FL_FL_GRID_H_ /** \file FL/Fl_Grid.H Fl_Grid container widget. */ #include #include /** Fl_Grid type for child widget alignment control. */ typedef unsigned short Fl_Grid_Align; /** Align the widget in the middle of the cell (default). */ const Fl_Grid_Align FL_GRID_CENTER = 0x0000; /** Align the widget at the top of the cell. */ const Fl_Grid_Align FL_GRID_TOP = 0x0001; /** Align the widget at the bottom of the cell. */ const Fl_Grid_Align FL_GRID_BOTTOM = 0x0002; /** Align the widget at the left side of the cell. */ const Fl_Grid_Align FL_GRID_LEFT = 0x0004; /** Align the widget at the right side of the cell. */ const Fl_Grid_Align FL_GRID_RIGHT = 0x0008; /** Stretch the widget horizontally to fill the cell. */ const Fl_Grid_Align FL_GRID_HORIZONTAL = 0x0010; /** Stretch the widget vertically to fill the cell. */ const Fl_Grid_Align FL_GRID_VERTICAL = 0x0020; /** Stretch the widget in both directions to fill the cell. */ const Fl_Grid_Align FL_GRID_FILL = 0x0030; /** Stretch the widget proportionally. */ const Fl_Grid_Align FL_GRID_PROPORTIONAL = 0x0040; const Fl_Grid_Align FL_GRID_TOP_LEFT = FL_GRID_TOP | FL_GRID_LEFT; const Fl_Grid_Align FL_GRID_TOP_RIGHT = FL_GRID_TOP | FL_GRID_RIGHT; const Fl_Grid_Align FL_GRID_BOTTOM_LEFT = FL_GRID_BOTTOM | FL_GRID_LEFT; const Fl_Grid_Align FL_GRID_BOTTOM_RIGHT = FL_GRID_BOTTOM | FL_GRID_RIGHT; /** Fl_Grid is a container (layout) widget with multiple columns and rows. This container widget features very flexible layouts in columns and rows w/o the need to position each child widget in x/y coordinates. Widgets are assigned to grid cells (column, row) with their minimal sizes in \p w() and \p h(). The \p x() and \p y() positions are ignored and can be (0, 0). Fl_Grid calculates widget positions and resizes the widgets to fit into the grid. It is possible to create a single row or column of widgets with Fl_Grid. You should design your grid with the smallest possible sizes of all widgets in mind. Fl_Grid will automatically assign additional space to cells according to some rules (described later) when resizing the Fl_Grid widget. \b Hint: You should set a minimum window size to make sure the Fl_Grid is never resized below its minimal sizes. Resizing below the given widget sizes results in undefined behavior. Fl_Grid and other container widgets (e.g. Fl_Group) can be nested. One main advantage of this usage is that widget coordinates in embedded Fl_Group widgets become relative to the group and will be positioned as expected. \todo This (relative group coordinates of nested groups of Fl_Grid) needs explanation and maybe an example. Fl_Grid child widgets are handled by its base class Fl_Group but Fl_Grid stores additional data corresponding to each widget in internal grid cells. Fl_Grid children are allowed to span multiple columns and rows like HTML \ cells. Individual children can have fixed sizes or be aligned inside their cells (left, right, top, bottom, and more) and/or follow their cell sizes when the Fl_Grid container is resized. Note to resizing: since Fl_Grid uses its own layout algorithm the normal Fl_Group::resizable() widget is ignored (if set). Calling init_sizes() is not necessary. \note Fl_Grid is, as of FLTK 1.4.x, still in experimental state and should be used with caution. The API can still be changed although it is assumed to be almost stable - as stable as possible for a first release. Example: Simple 3x3 Fl_Grid with five buttons: \n \code #include #include #include #include int main(int argc, char **argv) { Fl_Double_Window *win = new Fl_Double_Window(320, 180, "3x3 Fl_Grid with Buttons"); // create the Fl_Grid container with five buttons Fl_Grid *grid = new Fl_Grid(0, 0, win->w(), win->h()); grid->layout(3, 3, 10, 10); grid->color(FL_WHITE); Fl_Button *b0 = new Fl_Button(0, 0, 0, 0, "New"); Fl_Button *b1 = new Fl_Button(0, 0, 0, 0, "Options"); Fl_Button *b3 = new Fl_Button(0, 0, 0, 0, "About"); Fl_Button *b4 = new Fl_Button(0, 0, 0, 0, "Help"); Fl_Button *b6 = new Fl_Button(0, 0, 0, 0, "Quit"); // assign buttons to grid positions grid->widget(b0, 0, 0); grid->widget(b1, 0, 2); grid->widget(b3, 1, 1); grid->widget(b4, 2, 0); grid->widget(b6, 2, 2); grid->show_grid(0); // 1 to display grid helper lines grid->end(); win->end(); win->resizable(grid); win->size_range(300, 100); win->show(argc, argv); return Fl::run(); } \endcode \image html Fl_Grid.png \image latex Fl_Grid.png "Simple 3x3 Fl_Grid" width=7cm \image html Fl_Grid_show_grid_1.png \image latex Fl_Grid_show_grid_1.png "show_grid() set to 1" width=7cm */ class FL_EXPORT Fl_Grid : public Fl_Group { friend class Fl_Grid_Type; public: class Cell { friend class Fl_Grid; private: Cell *next_; // next cell in the same row short row_; // row number short col_; // column number short rowspan_; // row span (1 - n) short colspan_; // column span (1 - n) Fl_Grid_Align align_; // widget alignment in its cell Fl_Widget *widget_; // assigned widget int w_; // minimal widget width int h_; // minimal widget height public: void Cell_() { // common initialization next_ = NULL; row_ = 0; col_ = 0; rowspan_ = 1; colspan_ = 1; widget_ = NULL; w_ = 0; h_ = 0; align_ = 0; } Cell(int row, int col) { // constructor Cell_(); row_ = row; col_ = col; } Cell(Fl_Widget *w, int row, int col) { // widget assignment Cell_(); widget_ = w; row_ = row; col_ = col; } /** The destructor deletes the cell. \todo Fl_Grid's cell destructor should remove the cell from the grid. Currently it does nothing! */ ~Cell() {} /** Returns the next widget cell of the same row of this cell. */ Cell *next() { return next_; } /** Sets the \c next pointer of a grid's cell. \b Internal use only! Do not use this method, it may corrupt the allocated memory. \internal This method is public due to issue #937 but should be private or at least protected. For more info see GitHub issue #937. */ void next(Cell *c) { next_ = c; } Fl_Widget *widget() const { return widget_; } short row() const { return row_; } short col() const { return col_; } void rowspan(short v) { rowspan_ = v; } void colspan(short v) { colspan_ = v; } short rowspan() const { return rowspan_; } short colspan() const { return colspan_; } void align(Fl_Grid_Align align) { align_ = align; } Fl_Grid_Align align() const { return align_; } void minimum_size(int w, int h) { if (w>=0) w_ = w; if (h>=0) h_ = h; } void minimum_size(int *w, int *h) const { if (w) *w = w_; if (h) *h = h_; } }; // class Cell private: class Row; class Col; short rows_; short cols_; short margin_left_; // left margin short margin_top_; // top margin short margin_right_; // right margin short margin_bottom_; // bottom margin short gap_row_; // gap between rows short gap_col_; // gap between columns Fl_Rect old_size; // only for resize callback (TBD) Col *Cols_; // array of columns Row *Rows_; // array of rows bool need_layout_; // true if layout needs to be calculated protected: Fl_Color grid_color; // color for drawing the grid lines (design helper) bool draw_grid_; // draw the grid for testing / design protected: void init(); Cell *add_cell(int row, int col); void remove_cell(int row, int col); public: Fl_Grid(int X, int Y, int W, int H, const char *L = 0); virtual ~Fl_Grid(); // define and manage the layout and resizing virtual void layout(int rows, int cols, int margin = -1, int gap = -1); virtual void layout(); virtual void clear_layout(); virtual void resize(int X, int Y, int W, int H) FL_OVERRIDE; short rows() const { return rows_; } short cols() const { return cols_; } /** Request or reset the request to calculate the layout of children. If called with \p true (1) this calls redraw() to schedule a full draw(). When draw is eventually called, the layout is (re)calculated before actually drawing the widget. \param[in] set 1 to request layout calculation,\n 0 to reset the request */ void need_layout(int set) { if (set) { need_layout_ = true; redraw(); } else { need_layout_ = false; } } /** Return whether layout calculation is required. */ bool need_layout() const { return need_layout_; } protected: virtual void draw() FL_OVERRIDE; void on_remove(int) FL_OVERRIDE; virtual void draw_grid(); // draw grid lines for debugging public: // get and set individual margins virtual void margin(int left, int top = -1, int right = -1, int bottom = -1); int margin(int *left, int *top, int *right, int *bottom) const; // get and set default row and column gaps for all rows and columns, respectively virtual void gap(int row_gap, int col_gap = -1); // set default row and column gap(s) void gap(int *row_gap, int *col_gap) const; // find cells, get cell pointers Fl_Grid::Cell* cell(int row, int col) const; Fl_Grid::Cell* cell(Fl_Widget *widget) const; // assign a widget to a cell Fl_Grid::Cell* widget(Fl_Widget *wi, int row, int col, Fl_Grid_Align align = FL_GRID_FILL); Fl_Grid::Cell* widget(Fl_Widget *wi, int row, int col, int rowspan, int colspan, Fl_Grid_Align align = FL_GRID_FILL); // set minimal column and row sizes (widths and heights, respectively), // set row and column specific gaps and weights void col_width(int col, int value); void col_width(const int *value, size_t size); int col_width(int col) const; void col_weight(int col, int value); void col_weight(const int *value, size_t size); int col_weight(int col) const; void col_gap(int col, int value); void col_gap(const int *value, size_t size); int col_gap(int col) const; void row_height(int row, int value); void row_height(const int *value, size_t size); int row_height(int row) const; void row_weight(int row, int value); void row_weight(const int *value, size_t size); int row_weight(int row) const; void row_gap(int row, int value); void row_gap(const int *value, size_t size); int row_gap(int row) const; int computed_col_width(int col) const; int computed_row_height(int row) const; /** Enable or disable drawing of the grid helper lines for visualization. Use this method during the design stage of your Fl_Grid widget or for debugging if widgets are not positioned as intended. The default is a light green color but you can change it for better contrast if needed, see show_grid(int set, Fl_Color col). \note You can define the environment variable \c FLTK_GRID_DEBUG=1 to set show_grid(1) for all Fl_Grid widgets at construction time. This enables you to debug the grid layout w/o changing code. \param[in] set 1 (true) = draw, 0 = don't draw the grid \see show_grid(int set, Fl_Color col) */ void show_grid(int set) { draw_grid_ = set ? true : false; } /** Enable or disable drawing of the grid helper lines for visualization. This method also sets the color used for the helper lines. The default is a light green color but you can change it to any color for better contrast if needed. \param[in] set 1 (true) = draw, 0 = don't draw the grid \param[in] col color to use for the grid helper lines \see show_grid(int set) */ void show_grid(int set, Fl_Color col) { draw_grid_ = set ? true : false; grid_color = col; } void debug(int level = 127); }; // class Fl_Grid #endif // _FL_FL_GRID_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_Group.H ================================================ // // Group header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file \brief Fl_Group and Fl_End classes. */ #ifndef Fl_Group_H #define Fl_Group_H #include "Fl_Widget.H" // Don't #include Fl_Rect.H because this would introduce lots // of unnecessary dependencies on Fl_Rect.H class Fl_Rect; /** The Fl_Group class is the main FLTK container widget. It maintains an array of child widgets. These children can themselves be any widget including Fl_Group. The most important subclass of Fl_Group is Fl_Window, however groups can also be used to control radio buttons or to enforce resize behavior. The tab and arrow keys are used to move the focus between widgets of this group, and to other groups. The only modifier grabbed is shift (for shift-tab), so that ctrl-tab, alt-up, and such are free for the app to use as shortcuts. To remove a widget from the group and destroy it, in 1.3.x (and up) you can simply use: \code delete some_widget; \endcode ..and this will trigger proper scheduling of the widget's removal from its parent group. If used as a child of \p Fl_Tabs, setting \p when(FL_WHEN_CLOSED) will enable the Close button in the corresponding tab. If the user clicks the Close button, the callback of this group will be called with the callback reason \p FL_REASON_CLOSED. */ class FL_EXPORT Fl_Group : public Fl_Widget { union { Fl_Widget** array_; // used if group has two or more children or NULL Fl_Widget* child1_; // used if group has one child or NULL }; Fl_Widget* savedfocus_; Fl_Widget* resizable_; int children_; Fl_Rect *bounds_; // remembered initial sizes of children int *sizes_; // remembered initial sizes of children (FLTK 1.3 compat.) int navigation(int); static Fl_Group *current_; // unimplemented copy ctor and assignment operator Fl_Group(const Fl_Group&); Fl_Group& operator=(const Fl_Group&); protected: void draw() FL_OVERRIDE; void draw_child(Fl_Widget& widget) const; void draw_children(); void draw_outside_label(const Fl_Widget& widget) const ; void update_child(Fl_Widget& widget) const; Fl_Rect *bounds(); int *sizes(); // FLTK 1.3 compatibility virtual int on_insert(Fl_Widget*, int); virtual int on_move(int, int); virtual void on_remove(int); public: int handle(int) FL_OVERRIDE; void begin(); void end(); static Fl_Group *current(); static void current(Fl_Group *g); /** Returns how many child widgets the group has. */ int children() const { return children_; } /** Returns the n'th child. Returns \c NULL if \c n is out of range (since FLTK 1.4.0). No range checking was done in FLTK 1.3 and older versions! \param[in] n index of child (0 .. children() - 1) \return pointer to the n'th child or NULL if out of range */ Fl_Widget *child(int n) const { if (n < 0 || n > children() - 1) return NULL; return array()[n]; } int find(const Fl_Widget*) const; /** See int Fl_Group::find(const Fl_Widget *w) const */ int find(const Fl_Widget& o) const {return find(&o);} Fl_Widget* const* array() const; void resize(int,int,int,int) FL_OVERRIDE; /** Creates a new Fl_Group widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. */ Fl_Group(int,int,int,int, const char * = 0); virtual ~Fl_Group(); void add(Fl_Widget&); /** See void Fl_Group::add(Fl_Widget &w) */ void add(Fl_Widget* o) {add(*o);} void insert(Fl_Widget&, int i); /** This does insert(w, find(before)). This will append the widget if \p before is not in the group. */ void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));} void remove(int index); void remove(Fl_Widget&); /** Removes the widget \p o from the group. \sa void remove(Fl_Widget&) */ void remove(Fl_Widget* o) {remove(*o);} void clear(); /* delete child n (by index) */ virtual int delete_child(int n); /** Sets the group's resizable widget. See void Fl_Group::resizable(Fl_Widget *o) */ void resizable(Fl_Widget& o) {resizable_ = &o;} /** The resizable widget defines both the resizing box and the resizing behavior of the group and its children. If the resizable is NULL the group's size is fixed and all of the widgets in the group remain a fixed size and distance from the top-left corner. This is the default for groups derived from Fl_Window and Fl_Pack. The resizable may be set to the group itself, in which case all of the widgets that are its direct children are resized proportionally. This is the default value for Fl_Group. The resizable widget defines the resizing box for the group, which could be the group itself or one of the group's direct children. When the group is resized it calculates a new size and position for all of its children. Widgets that are horizontally or vertically inside the dimensions of the box are scaled to the new size. Widgets outside the box are moved. \note The resizable of a group \b must be one of - NULL - the group itself - a direct child of the group. \note If you set any other widget that is not a direct child of the group as its resizable then the behavior is undefined. This is \b not checked by Fl_Group for historical reasons. In these examples the gray area is the resizable: \image html resizebox1.png
\image html resizebox2.png \image latex resizebox1.png "before resize" width=4cm \image latex resizebox2.png "after resize" width=4.85cm It is possible to achieve any type of resize behavior by using an invisible Fl_Box as the resizable and/or by using a hierarchy of Fl_Group widgets, each with their own resizing strategies. See the \ref resize chapter for more examples and detailed explanation. \note The resizable() widget of a window can also affect the window's resizing behavior if Fl_Window::size_range() is not called. Please see Fl_Window::default_size_range() for more information on how the default size range is calculated. \see Fl_Window::size_range() \see Fl_Window::default_size_range() */ void resizable(Fl_Widget* o) {resizable_ = o;} /** Returns the group's resizable widget. See void Fl_Group::resizable(Fl_Widget *o) */ Fl_Widget* resizable() const {return resizable_;} /** Adds a widget to the group and makes it the resizable widget. */ void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);} void init_sizes(); /** Controls whether the group widget clips the drawing of child widgets to its bounding box. Set \p c to 1 if you want to clip the child widgets to the bounding box. The default is to not clip (0) the drawing of child widgets. */ void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); } /** Returns the current clipping mode. \return true, if clipping is enabled, false otherwise. \see void Fl_Group::clip_children(int c) */ unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; } // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. Fl_Group* as_group() FL_OVERRIDE { return this; } Fl_Group const* as_group() const FL_OVERRIDE { return this; } // back compatibility functions: /** \deprecated This is for backwards compatibility only. You should use \e W->%take_focus() instead. \sa Fl_Widget::take_focus(); */ void focus(Fl_Widget* W) {W->take_focus();} /** This is for forms compatibility only */ Fl_Widget* & _ddfdesign_kludge() {return resizable_;} /** This is for forms compatibility only */ void forms_end(); }; // dummy class used to end child groups in constructors for complex // subclasses of Fl_Group: /** This is a dummy class that allows you to end a Fl_Group in a constructor list of a class: \code class MyClass { Fl_Group group; Fl_Button button_in_group; Fl_End end; Fl_Button button_outside_group; MyClass(); }; MyClass::MyClass() : group(10,10,100,100), button_in_group(20,20,60,30), end(), button_outside_group(10,120,60,30) { [..ctor code..] } \endcode */ class FL_EXPORT Fl_End { public: /** All it does is calling Fl_Group::current()->end() */ Fl_End() {Fl_Group::current()->end();} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Help_Dialog.H ================================================ // // Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2021 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // ======================================================================== // DO NOT EDIT FL/Fl_Help_Dialog.H and src/Fl_Help_Dialog.cxx !!! // ======================================================================== // Please use fluid to change src/Fl_Help_Dialog.fl interactively // and then use fluid to "write code" or edit and use fluid -c . // ======================================================================== // // generated by Fast Light User Interface Designer (fluid) version 1.0402 #ifndef Fl_Help_Dialog_H #define Fl_Help_Dialog_H #include #include #include #include #include #include #include class FL_EXPORT Fl_Help_Dialog { int index_; int max_; int line_[100]; // FIXME: we must remove those static numbers char file_[100][FL_PATH_MAX]; // FIXME: we must remove those static numbers int find_pos_; public: Fl_Help_Dialog(); private: Fl_Double_Window *window_; Fl_Button *back_; inline void cb_back__i(Fl_Button*, void*); static void cb_back_(Fl_Button*, void*); Fl_Button *forward_; inline void cb_forward__i(Fl_Button*, void*); static void cb_forward_(Fl_Button*, void*); Fl_Button *smaller_; inline void cb_smaller__i(Fl_Button*, void*); static void cb_smaller_(Fl_Button*, void*); Fl_Button *larger_; inline void cb_larger__i(Fl_Button*, void*); static void cb_larger_(Fl_Button*, void*); Fl_Input *find_; inline void cb_find__i(Fl_Input*, void*); static void cb_find_(Fl_Input*, void*); Fl_Help_View *view_; inline void cb_view__i(Fl_Help_View*, void*); static void cb_view_(Fl_Help_View*, void*); public: ~Fl_Help_Dialog(); int h(); void hide(); int load(const char *f); void position(int xx, int yy); void resize(int xx, int yy, int ww, int hh); void show(); void show(int argc, char **argv); void textsize(Fl_Fontsize s); Fl_Fontsize textsize(); void topline(const char *n); void topline(int n); void value(const char *f); const char * value() const; int visible(); int w(); int x(); int y(); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Help_View.H ================================================ // // Help Viewer widget definitions. // // Copyright 1997-2010 by Easy Software Products. // Image support by Matthias Melcher, Copyright 2000-2009. // Copyright 2011-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Help_View widget . */ #ifndef Fl_Help_View_H #define Fl_Help_View_H // // Include necessary header files... // #include "Fl.H" #include "Fl_Group.H" #include "Fl_Scrollbar.H" #include "fl_draw.H" #include "filename.H" class Fl_Shared_Image; // // Fl_Help_Func type - link callback function for files... // typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *); // // Fl_Help_Block structure... // struct Fl_Help_Block { const char *start, // Start of text *end; // End of text uchar border; // Draw border? Fl_Color bgcolor; // Background color int x, // Indentation/starting X coordinate y, // Starting Y coordinate w, // Width h; // Height int line[32]; // Left starting position for each line int ol; // is ordered list

    element int ol_num; // item number in ordered list }; // // Fl_Help_Link structure... // /** Definition of a link for the html viewer. */ struct Fl_Help_Link { char filename[192], ///< Reference filename name[32]; ///< Link target (blank if none) int x, ///< X offset of link text y, ///< Y offset of link text w, ///< Width of link text h; ///< Height of link text }; /* * Fl_Help_View font stack opaque implementation */ /** Fl_Help_View font stack element definition. */ struct FL_EXPORT Fl_Help_Font_Style { Fl_Font f; ///< Font Fl_Fontsize s; ///< Font Size Fl_Color c; ///< Font Color void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);} Fl_Help_Font_Style(){} // For in table use }; /** Fl_Help_View font stack definition. */ const size_t MAX_FL_HELP_FS_ELTS = 100; struct FL_EXPORT Fl_Help_Font_Stack { /** font stack construction, initialize attributes. */ Fl_Help_Font_Stack() { nfonts_ = 0; } void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) { nfonts_ = 0; elts_[nfonts_].set(f, s, c); fl_font(f, s); fl_color(c); } /** Gets the top (current) element on the stack. */ void top(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { elts_[nfonts_].get(f, s, c); } /** Pushes the font style triplet on the stack, also calls fl_font() & fl_color() adequately */ void push(Fl_Font f, Fl_Fontsize s, Fl_Color c) { if (nfonts_ < MAX_FL_HELP_FS_ELTS-1) nfonts_ ++; elts_[nfonts_].set(f, s, c); fl_font(f, s); fl_color(c); } /** Pops from the stack the font style triplet and calls fl_font() & fl_color() adequately */ void pop(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { if (nfonts_ > 0) nfonts_ --; top(f, s, c); fl_font(f, s); fl_color(c); } /** Gets the current count of font style elements in the stack. */ size_t count() const {return nfonts_;} // Gets the current number of fonts in the stack protected: size_t nfonts_; ///< current number of fonts in stack Fl_Help_Font_Style elts_[MAX_FL_HELP_FS_ELTS]; ///< font elements }; /** Fl_Help_Target structure */ struct Fl_Help_Target { char name[32]; ///< Target name int y; ///< Y offset of target }; /** The Fl_Help_View widget displays HTML text. Most HTML 2.0 elements are supported, as well as a primitive implementation of tables. GIF, JPEG, and PNG images are displayed inline. Supported HTML tags: - A: HREF/NAME - B - BODY: BGCOLOR/TEXT/LINK - BR - CENTER - CODE - DD - DL - DT - EM - FONT: COLOR/SIZE/FACE=(helvetica/arial/sans/times/serif/symbol/courier) - H1/H2/H3/H4/H5/H6 - HEAD - HR - I - IMG: SRC/WIDTH/HEIGHT/ALT - KBD - LI - OL - P - PRE - STRONG - TABLE: TH/TD/TR/BORDER/BGCOLOR/COLSPAN/ALIGN=CENTER|RIGHT|LEFT - TITLE - TT - U - UL - VAR Supported color names: - black,red,green,yellow,blue,magenta,fuchsia,cyan,aqua,white,gray,grey,lime,maroon,navy,olive,purple,silver,teal. Supported urls: - Internal: file: - External: http: ftp: https: ipp: mailto: news: Quoted char names: - Aacute aacute Acirc acirc acute AElig aelig Agrave agrave amp Aring aring Atilde atilde Auml auml - brvbar bull - Ccedil ccedil cedil cent copy curren - dagger deg divide - Eacute eacute Ecirc ecirc Egrave egrave ETH eth Euml euml euro - frac12 frac14 frac34 - gt - Iacute iacute Icirc icirc iexcl Igrave igrave iquest Iuml iuml - laquo lt - macr micro middot - nbsp not Ntilde ntilde - Oacute oacute Ocirc ocirc Ograve ograve ordf ordm Oslash oslash Otilde otilde Ouml ouml - para permil plusmn pound - quot - raquo reg - sect shy sup1 sup2 sup3 szlig - THORN thorn times trade - Uacute uacute Ucirc ucirc Ugrave ugrave uml Uuml uuml - Yacute yacute - yen Yuml yuml \note You can't effectively set the box() to FL_NO_BOX, this would result in FL_DOWN_BOX being used as the boxtype of the widget. This is unexpected but can't be changed for backwards compatibility. If you don't want a frame around the widget you can use FL_FLAT_BOX instead. */ class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget enum { RIGHT = -1, CENTER, LEFT }; ///< Alignments char title_[1024]; ///< Title string Fl_Color defcolor_, ///< Default text color bgcolor_, ///< Background color textcolor_, ///< Text color linkcolor_; ///< Link color Fl_Font textfont_; ///< Default font for text Fl_Fontsize textsize_; ///< Default font size const char *value_; ///< HTML text value Fl_Help_Font_Stack fstack_; ///< font stack management int nblocks_, ///< Number of blocks/paragraphs ablocks_; ///< Allocated blocks Fl_Help_Block *blocks_; ///< Blocks Fl_Help_Func *link_; ///< Link transform function int nlinks_, ///< Number of links alinks_; ///< Allocated links Fl_Help_Link *links_; ///< Links int ntargets_, ///< Number of targets atargets_; ///< Allocated targets Fl_Help_Target *targets_; ///< Targets #if FL_ABI_VERSION >= 10401 char directory_[2 * FL_PATH_MAX + 15]; ///< Directory for current file #else char directory_[FL_PATH_MAX]; ///< Directory for current file #endif char filename_[FL_PATH_MAX]; ///< Current filename int topline_, ///< Top line in document leftline_, ///< Lefthand position size_, ///< Total document length hsize_, ///< Maximum document width scrollbar_size_; ///< Size for both scrollbars Fl_Scrollbar scrollbar_, ///< Vertical scrollbar for document hscrollbar_; ///< Horizontal scrollbar static int selection_first_; static int selection_last_; static int selection_push_first_; static int selection_push_last_; static int selection_drag_first_; static int selection_drag_last_; static int selected_; static int draw_mode_; static int mouse_x_; static int mouse_y_; static int current_pos_; static Fl_Help_View *current_view_; static Fl_Color hv_selection_color_; static Fl_Color hv_selection_text_color_; void initfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { f = textfont_; s = textsize_; c = textcolor_; fstack_.init(f, s, c); } void pushfont(Fl_Font f, Fl_Fontsize s) {fstack_.push(f, s, textcolor_);} void pushfont(Fl_Font f, Fl_Fontsize s, Fl_Color c) {fstack_.push(f, s, c);} void popfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {fstack_.pop(f, s, c);} Fl_Help_Block *add_block(const char *s, int xx, int yy, int ww, int hh, uchar border = 0); void add_link(const char *n, int xx, int yy, int ww, int hh); void add_target(const char *n, int yy); static int compare_targets(const Fl_Help_Target *t0, const Fl_Help_Target *t1); int do_align(Fl_Help_Block *block, int line, int xx, int a, int &l); protected: void draw() FL_OVERRIDE; private: void format(); void format_table(int *table_width, int *columns, const char *table); void free_data(); int get_align(const char *p, int a); const char *get_attr(const char *p, const char *n, char *buf, int bufsize); Fl_Color get_color(const char *n, Fl_Color c); Fl_Shared_Image *get_image(const char *name, int W, int H); int get_length(const char *l); public: int handle(int) FL_OVERRIDE; private: void hv_draw(const char *t, int x, int y, int entity_extra_length = 0); char begin_selection(); char extend_selection(); void end_selection(int c=0); void clear_global_selection(); Fl_Help_Link *find_link(int, int); void follow_link(Fl_Help_Link*); public: static const char *copy_menu_text; Fl_Help_View(int xx, int yy, int ww, int hh, const char *l = 0); ~Fl_Help_View(); /** Returns the current directory for the text in the buffer. */ const char *directory() const { if (directory_[0]) return (directory_); else return ((const char *)0); } /** Returns the current filename for the text in the buffer. */ const char *filename() const { if (filename_[0]) return (filename_); else return ((const char *)0); } int find(const char *s, int p = 0); /** This method assigns a callback function to use when a link is followed or a file is loaded (via Fl_Help_View::load()) that requires a different file or path. The callback function receives a pointer to the Fl_Help_View widget and the URI or full pathname for the file in question. It must return a pathname that can be opened as a local file or NULL: \code const char *fn(Fl_Widget *w, const char *uri); \endcode The link function can be used to retrieve remote or virtual documents, returning a temporary file that contains the actual data. If the link function returns NULL, the value of the Fl_Help_View widget will remain unchanged. If the link callback cannot handle the URI scheme, it should return the uri value unchanged or set the value() of the widget before returning NULL. */ void link(Fl_Help_Func *fn) { link_ = fn; } int load(const char *f); void resize(int,int,int,int) FL_OVERRIDE; /** Gets the size of the help view. */ int size() const { return (size_); } void size(int W, int H) { Fl_Widget::size(W, H); } /** Sets the default text color. */ void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; } /** Returns the current default text color. */ Fl_Color textcolor() const { return (defcolor_); } /** Sets the default text font. */ void textfont(Fl_Font f) { textfont_ = f; format(); } /** Returns the current default text font. */ Fl_Font textfont() const { return (textfont_); } /** Sets the default text size. */ void textsize(Fl_Fontsize s) { textsize_ = s; format(); } /** Gets the default text size. */ Fl_Fontsize textsize() const { return (textsize_); } /** Returns the current document title, or NULL if there is no title. */ const char *title() { return (title_); } void topline(const char *n); void topline(int); /** Returns the current top line in pixels. */ int topline() const { return (topline_); } void leftline(int); /** Gets the left position in pixels. */ int leftline() const { return (leftline_); } void value(const char *val); /** Returns the current buffer contents. */ const char *value() const { return (value_); } void clear_selection(); void select_all(); /** Gets the current size of the scrollbars' troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbar's width. \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. \see Fl::scrollbar_size(int) */ int scrollbar_size() const { return(scrollbar_size_); } /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets' scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting \p newSize to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. \param[in] newSize Sets the scrollbar size in pixels.\n If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() \see Fl::scrollbar_size() */ void scrollbar_size(int newSize) { scrollbar_size_ = newSize; } // Check if the user selected text in this view. int text_selected(); // If text is selected in this view, copy it to a clipboard. int copy(int clipboard=1); }; #endif // !Fl_Help_View_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Hold_Browser.H ================================================ // // Hold browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Hold_Browser widget . */ #ifndef Fl_Hold_Browser_H #define Fl_Hold_Browser_H #include "Fl_Browser.H" /** The Fl_Hold_Browser is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. \image html fl_hold_browser.png "Fl_Hold_Browser" \image latex fl_hold_browser.png "Fl_Hold_Browser" width=4cm As long as the mouse button is held down the item pointed to by it is highlighted, and this highlighting remains on when the mouse button is released. Normally the callback is done when the user releases the mouse, but you can change this with when().

    See Fl_Browser for methods to add and remove lines from the browser. */ class FL_EXPORT Fl_Hold_Browser : public Fl_Browser { public: /** Creates a new Fl_Hold_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. */ Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Hor_Fill_Slider.H ================================================ // // Horizontal fill slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Hor_Fill_Slider widget . */ #ifndef Fl_Hor_Fill_Slider_H #define Fl_Hor_Fill_Slider_H #include "Fl_Slider.H" class FL_EXPORT Fl_Hor_Fill_Slider : public Fl_Slider { public: Fl_Hor_Fill_Slider(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Hor_Nice_Slider.H ================================================ // // Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Hor_Nice_Slider widget . */ #ifndef Fl_Hor_Nice_Slider_H #define Fl_Hor_Nice_Slider_H #include "Fl_Slider.H" /** \class Fl_Hor_Nice_Slider \brief Single thumb tab slider \image html fl_hor_nice_slider.png "Fl_Hor_Nice_Slider with various Fl::scheme() values" \image latex fl_hor_nice_slider.png "Fl_Hor_Nice_Slider with various Fl::scheme() values" width=6cm **/ class FL_EXPORT Fl_Hor_Nice_Slider : public Fl_Slider { public: Fl_Hor_Nice_Slider(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Hor_Slider.H ================================================ // // Horizontal slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Hor_Slider widget . */ #ifndef Fl_Hor_Slider_H #define Fl_Hor_Slider_H #include "Fl_Slider.H" /** Horizontal Slider class. \see class Fl_Slider. */ class FL_EXPORT Fl_Hor_Slider : public Fl_Slider { public: /** Creates a new Fl_Hor_Slider widget using the given position, size, and label string. */ Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Hor_Value_Slider.H ================================================ // // Horizontal value slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Hor_Value_Slider widget . */ #ifndef Fl_Hor_Value_Slider_H #define Fl_Hor_Value_Slider_H #include "Fl_Value_Slider.H" class FL_EXPORT Fl_Hor_Value_Slider : public Fl_Value_Slider { public: Fl_Hor_Value_Slider(int X,int Y,int W,int H,const char *l=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_ICO_Image.H ================================================ // // ICO image header file for the Fast Light Tool Kit (FLTK). // // Copyright 2022-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // http://www.fltk.org/COPYING.php // // Please report all bugs and problems on the following page: // // http://www.fltk.org/str.php // // https://en.wikipedia.org/wiki/ICO_(file_format) // http://www.daubnet.com/en/file-format-ico #ifndef Fl_ICO_Image_H # define Fl_ICO_Image_H # include "Fl_BMP_Image.H" /** The Fl_ICO_Image class supports loading, caching, and drawing of Windows icon (.ico) files. */ class FL_EXPORT Fl_ICO_Image : public Fl_BMP_Image { public: /** Windows ICONDIRENTRY structure */ struct IconDirEntry { int bWidth; ///< Image width int bHeight; ///< Image height int bColorCount; ///< Number of colors (0 if ≥ 8bpp) int bReserved; ///< Reserved int wPlanes; ///< Color Planes int wBitCount; ///< Bits per pixel int dwBytesInRes; ///< Resource size in bytes int dwImageOffset; ///< Offset to the image }; Fl_ICO_Image(const char *filename, int id = -1, const unsigned char *data = NULL, const size_t datasize = 0); ~Fl_ICO_Image(); /** Returns the number of icons of various resolutions present in the ICO object. */ int idcount() const { return idcount_; } /** Returns the array of idcount() loaded IconDirEntry structures. */ const IconDirEntry * icondirentry() const { return icondirentry_; } private: int idcount_; struct IconDirEntry *icondirentry_; void load_ico_(class Fl_Image_Reader &rdr, int id); }; #endif // Fl_ICO_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Image.H ================================================ // // Image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Image, Fl_RGB_Image classes. */ #ifndef Fl_Image_H #define Fl_Image_H #include "Enumerations.H" #include "Fl_Widget.H" // for fl_uintptr_t class Fl_Widget; class Fl_Pixmap; struct Fl_Menu_Item; struct Fl_Label; class Fl_RGB_Image; /** \enum Fl_RGB_Scaling The scaling algorithm to use for RGB images. */ enum Fl_RGB_Scaling { FL_RGB_SCALING_NEAREST = 0, ///< default RGB image scaling algorithm FL_RGB_SCALING_BILINEAR ///< more accurate, but slower RGB image scaling algorithm }; /** Base class for image caching, scaling and drawing. Fl_Image is the base class used for caching, scaling and drawing all kinds of images in FLTK. This class keeps track of common image data such as the pixels, colormap, width, height, and depth. Virtual methods are used to provide type-specific image handling. Each image possesses two (width, height) pairs: -# The width and height of the raw image data are returned by data_w() and data_h(). These values are set when the image is created and remain unchanged. -# The width and height of the area filled by the image when it gets drawn are returned by w() and h(). These values are equal to data_w() and data_h() when the image is created and can be changed by the scale() member function. Since the Fl_Image class does not support image drawing by itself, calling the Fl_Image::draw() method results in a box with an X in it being drawn instead. */ class FL_EXPORT Fl_Image { friend class Fl_Graphics_Driver; public: static const int ERR_NO_IMAGE = -1; static const int ERR_FILE_ACCESS = -2; static const int ERR_FORMAT = -3; static const int ERR_MEMORY_ACCESS = -4; private: int w_, h_, d_, ld_, count_; int data_w_, data_h_; const char * const *data_; static Fl_RGB_Scaling RGB_scaling_; // method used when copying RGB images static Fl_RGB_Scaling scaling_algorithm_; // method used to rescale RGB source images before drawing // Forbid use of copy constructor and assign operator Fl_Image & operator=(const Fl_Image &); Fl_Image(const Fl_Image &); // Presently redefined in Fl_SVG_Image virtual void cache_size_(int &/*width*/, int &/*height*/) {} protected: /** Sets the width of the image data. This protected function sets both image widths: the width of the image data returned by data_w() and the image drawing width in FLTK units returned by w(). */ void w(int W) {w_ = W; data_w_ = W;} /** Sets the height of the image data. This protected function sets both image heights: the height of the image data returned by data_h() and the image drawing height in FLTK units returned by h(). */ void h(int H) {h_ = H; data_h_ = H;} /** Sets the current image depth. */ void d(int D) {d_ = D;} /** Sets the current line data size in bytes. Color images may contain extra data (padding) that is included after every line of color image data and is normally not present. If \p LD is zero, then line data size is assumed to be data_w() * d() bytes. If \p LD is non-zero, then it must be positive and larger than data_w() * d() to account for the extra data per line. */ void ld(int LD) {ld_ = LD;} /** Sets the current data pointer and count of pointers in the array. There can be 0, 1, or more pointers to actual image data in an image. \see const char* const* data(), count(), w(), h(), data_w(), data_h(), d(), ld() */ void data(const char * const *p, int c) {data_ = p; count_ = c;} void draw_empty(int X, int Y); static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la); static void measure(const Fl_Label *lo, int &lw, int &lh); int draw_scaled(int X, int Y, int W, int H); public: /** Returns the current image drawing width in FLTK units. The values of w() and data_w() are identical unless scale() has been called after which they may differ. */ int w() const {return w_;} /** Returns the current image drawing height in FLTK units. The values of h() and data_h() are identical unless scale() has been called after which they may differ. */ int h() const {return h_;} /** Returns the width of the image data. */ int data_w() const {return data_w_;} /** Returns the height of the image data. */ int data_h() const {return data_h_;} /** Returns the image depth. The return value will be 0 for bitmaps, 1 for pixmaps, and 1 to 4 for color images.

    */ int d() const {return d_;} /** Returns the current line data size in bytes. \see ld(int) */ int ld() const {return ld_;} /** Returns the number of data values associated with the image. The value will be 0 for images with no associated data, 1 for bitmap and color images, and greater than 2 for pixmap images. \see data() */ int count() const {return count_;} /** Returns a pointer to the current image data array. There can be 0, 1, or more pointers to actual image data in an image. Use the count() method to find the size of the data array. You must not dereference the data() pointer if count() equals zero. \note data() \b may return NULL. Example: Fl_RGB_Image has exactly one pointer which points at the R, G, B [, A] data array of the image. The total size of this array depends on several attributes like data_w(), data_h(), d() and ld() and is basically data_w() * data_h() * d() but there are exceptions if ld() is non-zero: see description of ld(). Since FLTK 1.4.0 w() and h() are no longer significant for the image data size if scale() has been called on the image to set a different display size. Other image types have different numbers and types of data pointers which are implementation details and not documented here. \see count(), w(), h(), data_w(), data_h(), d(), ld() */ const char * const *data() const {return data_;} int fail() const; /** Releases an Fl_Image - the same as '\p delete \p this'. This virtual method is for almost all image classes the same as calling \code delete image; \endcode where image is an \p Fl_Image \p * pointer. However, for subclass Fl_Shared_Image and its subclasses this virtual method is reimplemented and maintains shared images. This virtual method makes it possible to \p destroy all image types in the same way by calling \code image->release(); \endcode Reasoning: If you have an 'Fl_Image *' base class pointer and don't know if the object is one of the class Fl_Shared_Image or any other subclass of Fl_Image (for instance Fl_RGB_Image) then you can't just use operator delete since this is not appropriate for Fl_Shared_Image objects. The virtual method release() handles this properly. \since 1.4.0 in the base class Fl_Image and virtual in Fl_Shared_Image */ virtual void release() { delete this; } /** Returns whether an image is an Fl_Shared_Image or not. This virtual method returns a pointer to an Fl_Shared_Image if this object is an instance of Fl_Shared_Image or NULL if not. This can be used to detect if a given Fl_Image object is a shared image, i.e. derived from Fl_Shared_Image. \since 1.4.0 */ virtual class Fl_Shared_Image *as_shared_image() { return 0; } Fl_Image(int W, int H, int D); virtual ~Fl_Image(); virtual Fl_Image *copy(int W, int H) const; /** Creates a copy of the image in the same size. The new image should be released when you are done with it. This does exactly the same as 'Fl_Image::copy(int W, int H) const' where \p W and \p H are the width and height of the source image, respectively. This applies also to all subclasses of Fl_Image in the FLTK library. The following two copy() calls are equivalent: \code Fl_Image *img1 = new Fl_Image(...); // ... Fl_Image *img2 = img1->copy(); Fl_Image *img3 = img1->copy(img1->w(), img1->h()) \endcode For details see 'Fl_Image::copy(int w, int h) const'. \see Fl_Image::release() \note Since FLTK 1.4.0 this method is 'const'. If you derive your own class from Fl_Image or any subclass your overridden methods of 'Fl_Image::copy() const' and 'Fl_Image::copy(int, int) const' \b must also be 'const' for inheritance to work properly. This is different than in FLTK 1.3.x and earlier where these methods have not been 'const'. */ Fl_Image *copy() const { return copy(w(), h()); } virtual void color_average(Fl_Color c, float i); /** The inactive() method calls color_average(\ref FL_BACKGROUND_COLOR, 0.33f) to produce an image that appears grayed out. An internal copy is made of the original image before changes are applied, to avoid modifying the original image. \note The RGB color of \ref FL_BACKGROUND_COLOR may change when the connection to the display is made. See fl_open_display(). */ void inactive() { color_average(FL_GRAY, .33f); } virtual void desaturate(); virtual void label(Fl_Widget*w); virtual void label(Fl_Menu_Item*m); /** Draws the image to the current drawing surface with a bounding box. Arguments X,Y,W,H specify a bounding box for the image, with the origin (upper-left corner) of the image offset by the \c cx and \c cy arguments. In other words: fl_push_clip(X,Y,W,H) is applied, the image is drawn with its upper-left corner at X-cx,Y-cy and its own width and height, fl_pop_clip() is applied. */ virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent /** Draws the image to the current drawing surface. \param X, Y specify the upper-lefthand corner of the image. */ void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent virtual void uncache(); // used by fl_define_FL_IMAGE_LABEL() to avoid 'friend' declaration static Fl_Labeltype define_FL_IMAGE_LABEL(); // set RGB image scaling method static void RGB_scaling(Fl_RGB_Scaling); // get RGB image scaling method static Fl_RGB_Scaling RGB_scaling(); // set the image drawing size virtual void scale(int width, int height, int proportional = 1, int can_expand = 0); /** Sets what algorithm is used when resizing a source image to draw it. The default algorithm is FL_RGB_SCALING_BILINEAR. Drawing an Fl_Image is sometimes performed by first resizing the source image and then drawing the resized copy. This occurs, e.g., when drawing to screen under X11 without Xrender support after having called scale(). This function controls what method is used when the image to be resized is an Fl_RGB_Image. \version 1.4 */ static void scaling_algorithm(Fl_RGB_Scaling algorithm) {scaling_algorithm_ = algorithm; } /** Gets what algorithm is used when resizing a source image to draw it. */ static Fl_RGB_Scaling scaling_algorithm() {return scaling_algorithm_;} static bool register_images_done; }; class Fl_SVG_Image; /** The Fl_RGB_Image class supports caching and drawing of full-color images with 1 to 4 channels of color information. Images with an even number of channels are assumed to contain alpha information, which is used to blend the image with the contents of the screen. Fl_RGB_Image is defined in <FL/Fl_Image.H>, however for compatibility reasons <FL/Fl_RGB_Image.H> should be included. */ class FL_EXPORT Fl_RGB_Image : public Fl_Image { friend class Fl_Graphics_Driver; static size_t max_size_; public: /** Points to the start of the object's data array \see class Fl_SVG_Image which delays initialization of this member variable. */ const uchar *array; /** If non-zero, the object's data array is delete[]'d when deleting the object. */ int alloc_array; private: // These two variables are used to cache the image and mask for the main display graphics driver fl_uintptr_t id_; fl_uintptr_t mask_; int cache_w_, cache_h_; // size of image when cached public: Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0); Fl_RGB_Image(const uchar *bits, int bits_length, int W, int H, int D, int LD); Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); ~Fl_RGB_Image() FL_OVERRIDE; Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Image::copy(); } void color_average(Fl_Color c, float i) FL_OVERRIDE; void desaturate() FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx=0, int cy=0) FL_OVERRIDE; void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; int cache_w() {return cache_w_;} int cache_h() {return cache_h_;} /** Sets the maximum allowed image size in bytes when creating an Fl_RGB_Image object. The image size in bytes of an Fl_RGB_Image object is the value of the product w() * h() * d(). If this product exceeds size, the created object of a derived class of Fl_RGB_Image won't be loaded with the image data. This does not apply to direct RGB image creation with Fl_RGB_Image::Fl_RGB_Image(const uchar *bits, int W, int H, int D, int LD). The default max_size() value is essentially infinite. */ static void max_size(size_t size) { max_size_ = size;} /** Returns the maximum allowed image size in bytes when creating an Fl_RGB_Image object. \sa void Fl_RGB_Image::max_size(size_t) */ static size_t max_size() {return max_size_;} /** Returns whether an image is an Fl_SVG_Image or not. This virtual method returns a pointer to the Fl_SVG_Image if this object is an instance of Fl_SVG_Image or NULL if not. */ virtual Fl_SVG_Image *as_svg_image() { return NULL; } /** Makes sure the object is fully initialized. In particular, makes sure member variable \ref array is non-null. */ virtual void normalize() {} }; #endif // !Fl_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Image_Surface.H ================================================ // // Draw-to-image code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Image_Surface_H #define Fl_Image_Surface_H #include #include #include #include // for Fl_Offscreen /** \brief Directs all graphics requests to an Fl_Image. After creation of an Fl_Image_Surface object, make it the current drawing surface calling Fl_Surface_Device::push_current(), and all subsequent graphics requests will be recorded in the image. It's possible to draw widgets (using Fl_Image_Surface::draw()) or to use any of the \ref fl_drawings or the \ref fl_attributes. Finally, call image() on the object to obtain a newly allocated Fl_RGB_Image object. Fl_Gl_Window objects can be drawn in the image as well. Usage example: \code // this is the widget that you want to draw into an image Fl_Widget *g = ...; // create an Fl_Image_Surface object Fl_Image_Surface *image_surface = new Fl_Image_Surface(g->w(), g->h()); // direct all further graphics requests to the image Fl_Surface_Device::push_current(image_surface); // draw a white background fl_color(FL_WHITE); fl_rectf(0, 0, g->w(), g->h()); // draw the g widget in the image image_surface->draw(g); // get the resulting image Fl_RGB_Image* image = image_surface->image(); // direct graphics requests back to their previous destination Fl_Surface_Device::pop_current(); // delete the image_surface object, but not the image itself delete image_surface; \endcode */ class FL_EXPORT Fl_Image_Surface : public Fl_Widget_Surface { friend class Fl_Graphics_Driver; private: class Fl_Image_Surface_Driver *platform_surface; Fl_Offscreen get_offscreen_before_delete_(); protected: void translate(int x, int y) FL_OVERRIDE; void untranslate() FL_OVERRIDE; public: Fl_Image_Surface(int w, int h, int high_res = 0, Fl_Offscreen off = 0); ~Fl_Image_Surface(); void set_current() FL_OVERRIDE; bool is_current() FL_OVERRIDE; Fl_RGB_Image *image(); Fl_Shared_Image *highres_image(); void origin(int *x, int *y) FL_OVERRIDE; void origin(int x, int y) FL_OVERRIDE; int printable_rect(int *w, int *h) FL_OVERRIDE; Fl_Offscreen offscreen(); void rescale(); void mask(const Fl_RGB_Image *); }; /** \cond DriverDev \addtogroup DriverDeveloper \{ */ /** A base class describing the interface between FLTK and draw-to-image operations. This class is only for internal use by the FLTK library. A supported platform should implement the virtual methods of this class in order to support drawing to an Fl_RGB_Image through class Fl_Image_Surface. */ class Fl_Image_Surface_Driver : public Fl_Widget_Surface { friend class Fl_Image_Surface; private: Fl_Image_Surface *image_surface_; protected: int width; int height; Fl_Offscreen offscreen; int external_offscreen; Fl_Image_Surface_Driver(int w, int h, int /*high_res*/, Fl_Offscreen off) : Fl_Widget_Surface(NULL), width(w), height(h), offscreen(off) {external_offscreen = (off != 0);} virtual ~Fl_Image_Surface_Driver() {} static void copy_with_mask(Fl_RGB_Image* mask, uchar *dib_dst, uchar *dib_src, int line_size, bool bottom_to_top); static Fl_RGB_Image *RGB3_to_RGB1(const Fl_RGB_Image *rgb3, int W, int H); void set_current() FL_OVERRIDE = 0; void translate(int x, int y) FL_OVERRIDE = 0; void untranslate() FL_OVERRIDE = 0; int printable_rect(int *w, int *h) FL_OVERRIDE; virtual Fl_RGB_Image *image() = 0; virtual void mask(const Fl_RGB_Image *) {} /** Each platform implements this function its own way. It returns an object implementing all virtual functions of class Fl_Image_Surface_Driver for the plaform. */ static Fl_Image_Surface_Driver *newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off); public: /** Returns pointer to the associated Fl_Image_Surface object */ Fl_Image_Surface *image_surface() { return image_surface_; } }; /** \} \endcond */ #endif // Fl_Image_Surface_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Input.H ================================================ // // Input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Input widget . */ #ifndef Fl_Input_H #define Fl_Input_H #include "Fl_Input_.H" /** This is the FLTK text input widget. It displays a single line of text and lets the user edit it. Normally it is drawn with an inset box and a white background. The text may contain any characters, and will correctly display any UTF text, using ^X notation for unprintable control characters. It assumes the font can draw any characters of the used scripts, which is true for standard fonts under Windows and Mac OS X. Characters can be input using the keyboard or the character palette/map. Character composition is done using dead keys and/or a compose key as defined by the operating system.

    Keyboard and mouse bindings.
    Mouse button 1 Moves the cursor to this point. Drag selects characters. Double click selects words. Triple click selects all line. Shift+click extends the selection. When you select text it is automatically copied to the selection buffer.
    Mouse button 2 Insert the selection buffer at the point clicked. You can also select a region and replace it with the selection buffer by selecting the region with mouse button 2.
    Mouse button 3 Currently acts like button 1.
    Backspace Deletes one character to the left, or deletes the selected region.
    Delete Deletes one character to the right, or deletes the selected region. Combine with Shift for equivalent of ^X (copy+cut).
    Enter May cause the callback, see when().

    Platform specific keyboard bindings.
    Windows/Linux Mac Function
    ^A Command-A Selects all text in the widget.
    ^C Command-C Copy the current selection to the clipboard.
    ^I ^I Insert a tab.
    ^J ^J Insert a Line Feed.
    (Similar to literal 'Enter' character)
    ^L ^L Insert a Form Feed.
    ^M ^M Insert a Carriage Return.
    ^V,
    Shift-Insert
    Command-V Paste the clipboard.
    (Macs keyboards don't have "Insert" keys, but if they did, Shift-Insert would work)
    ^X,
    Shift-Delete
    Command-X,
    Shift-Delete
    Cut.
    Copy the selection to the clipboard and delete it. (If there's no selection, Shift-Delete acts like Delete)
    ^Z Command-Z Undo.
    This is a single-level undo mechanism, but all adjacent deletions and insertions are concatenated into a single "undo". Often this will undo a lot more than you expected.
    Shift-^Z Shift-Command-Z Redo.
    Currently same behavior as ^Z. Reserved for future multilevel undo/redo.
    Arrow Keys Arrow Keys Standard cursor movement.
    Can be combined with Shift to extend selection.
    Home Command-Up,
    Command-Left
    Move to start of line.
    Can be combined with Shift to extend selection.
    End Command-Down,
    Command-Right
    Move to end of line.
    Can be combined with Shift to extend selection.
    Ctrl-Home Command-Up,
    Command-PgUp,
    Ctrl-Left
    Move to top of document/field.
    In single line input, moves to start of line. In multiline input, moves to start of top line. Can be combined with Shift to extend selection.
    Ctrl-End Command-End,
    Command-PgDn,
    Ctrl-Right
    Move to bottom of document/field.
    In single line input, moves to end of line. In multiline input, moves to end of last line. Can be combined with Shift to extend selection.
    Ctrl-Left Alt-Left Word left.
    Can be combined with Shift to extend selection.
    Ctrl-Right Alt-Right Word right.
    Can be combined with Shift to extend selection.
    Ctrl-Backspace Alt-Backspace Delete word left.
    Ctrl-Delete Alt-Delete Delete word right.
    */ class FL_EXPORT Fl_Input : public Fl_Input_ { friend class Fl_Screen_Driver; friend class Fl_Cocoa_Screen_Driver; // Not ideal, but probably no other platform will use it int shift_position(int p); int shift_up_down_position(int p); void handle_mouse(int keepmark=0); // Private keyboard functions int kf_lines_up(int repeat_num); int kf_lines_down(int repeat_num); int kf_page_up(); int kf_page_down(); int kf_insert_toggle(); int kf_delete_word_right(); int kf_delete_word_left(); int kf_delete_sol(); int kf_delete_eol(); int kf_delete_char_right(); int kf_delete_char_left(); int kf_move_sol(); int kf_move_eol(); int kf_clear_eol(); int kf_move_char_left(); int kf_move_char_right(); int kf_move_word_left(); int kf_move_word_right(); int kf_move_up_and_sol(); int kf_move_down_and_eol(); int kf_top(); int kf_bottom(); int kf_select_all(); int kf_undo(); int kf_redo(); int kf_copy(); int kf_paste(); int kf_copy_cut(); protected: void draw() FL_OVERRIDE; int handle_key(); int handle_rmb(); public: int handle(int) FL_OVERRIDE; Fl_Input(int,int,int,int,const char * = 0); static const char *cut_menu_text; static const char *copy_menu_text; static const char *paste_menu_text; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Input_.H ================================================ // // Input base class header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2015 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Input_ widget . */ #ifndef Fl_Input__H #define Fl_Input__H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif #define FL_NORMAL_INPUT 0 #define FL_FLOAT_INPUT 1 #define FL_INT_INPUT 2 #define FL_HIDDEN_INPUT 3 #define FL_MULTILINE_INPUT 4 #define FL_SECRET_INPUT 5 #define FL_INPUT_TYPE 7 #define FL_INPUT_READONLY 8 #define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY) #define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY) #define FL_INPUT_WRAP 16 #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP) #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP) class Fl_Input_Undo_Action; class Fl_Input_Undo_Action_List; /** This class provides a low-overhead text input field. This is a virtual base class below Fl_Input. It has all the same interfaces, but lacks the handle() and draw() method. You may want to subclass it if you are one of those people who likes to change how the editing keys work. It may also be useful for adding scrollbars to the input field. This can act like any of the subclasses of Fl_Input, by setting type() to one of the following values: \code #define FL_NORMAL_INPUT 0 #define FL_FLOAT_INPUT 1 #define FL_INT_INPUT 2 #define FL_MULTILINE_INPUT 4 #define FL_SECRET_INPUT 5 #define FL_INPUT_TYPE 7 #define FL_INPUT_READONLY 8 #define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY) #define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY) #define FL_INPUT_WRAP 16 #define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP) #define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP) \endcode All variables that represent an index into a text buffer are byte-oriented, not character oriented, counting from 0 (at or before the first character) to size() (at the end of the buffer, after the last byte). Since UTF-8 characters can be up to six bytes long, simply incrementing such an index will not reliably advance to the next character in the text buffer. Indices and pointers into the text buffer should always point at a 7 bit ASCII character or the beginning of a UTF-8 character sequence. Behavior for false UTF-8 sequences and pointers into the middle of a sequence are undefined. \see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets \see Fl_Widget::shortcut_label(int) \internal When porting this widget from ASCII to UTF-8, previously legal pointers into the text of this widget can become illegal by pointing into the middle of a UTF-8 sequence. This is not a big problem for Fl_Input_ because all code in this module is quite tolerant. It could be problematic though when deriving from this class because no feedback for illegal pointers is given. Additionally, a careless "copy" call can put partial UTF-8 sequences into the clipboard. None of these issues should be disastrous. Nevertheless, we should discuss how FLTK should handle false UTF-8 sequences and pointers. */ class FL_EXPORT Fl_Input_ : public Fl_Widget { /** \internal Storage for the text field. */ const char* value_; /** \internal Buffer memory for expanded text. \see expand() */ char* buffer; /** \internal Size of text in bytes in the \p value_ field. */ int size_; /** \internal Current size of internal value() buffer in bytes. */ int bufsize; /** \internal Position of the cursor in the document. */ int position_; /** \internal Position of the other end of the selected text. If \p position_ equals \p mark_, no text is selected */ int mark_; /** \internal Behavior of Tab key in multiline input widget. If enabled (default) Tab causes focus nav, otherwise Tab is inserted as a character. */ int tab_nav_; /** \internal Offset to text origin within widget bounds */ int xscroll_, yscroll_; /** \internal Minimal update pointer. Display requires redraw from here to the end of the buffer. */ int mu_p; /** \internal Maximum number of (UTF-8) characters a user can input. */ int maximum_size_; /** \internal Shortcut key that will fetch focus for this widget. */ int shortcut_; /** \internal This is set if no text but only the cursor needs updating. */ uchar erase_cursor_only; /** \internal The font used for the entire text. */ Fl_Font textfont_; /** \internal Height of the font used for the entire text. */ Fl_Fontsize textsize_; /** \internal color of the entire text */ Fl_Color textcolor_; /** \internal color of the text cursor */ Fl_Color cursor_color_; /** \internal local undo event */ Fl_Input_Undo_Action* undo_; Fl_Input_Undo_Action_List* undo_list_; Fl_Input_Undo_Action_List* redo_list_; /** \internal Horizontal cursor position in pixels while moving up or down. */ static double up_down_pos; /** \internal Flag to remember last cursor move. */ static int was_up_down; /* Convert a given text segment into the text that will be rendered on screen. */ const char* expand(const char*, char*) const; /* Calculates the width in pixels of part of a text buffer. */ double expandpos(const char*, const char*, const char*, int*) const; /* Mark a range of characters for update. */ void minimal_update(int, int); /* Mark a range of characters for update. */ void minimal_update(int p); /* Copy the value from a possibly static entry into the internal buffer. */ void put_in_buffer(int newsize); /* Set the current font and font size. */ void setfont() const; protected: /* Find the start of a word. */ int word_start(int i) const; /* Find the end of a word. */ int word_end(int i) const; /* Find the start of a line. */ int line_start(int i) const; /* Find the end of a line. */ int line_end(int i) const; /* Draw the text in the passed bounding box. */ void drawtext(int, int, int, int); /* Draw the text in the passed bounding box. */ void drawtext(int, int, int, int, bool draw_active); /* Move the cursor to the column given by up_down_pos. */ int up_down_position(int, int keepmark=0); /* Handle mouse clicks and mouse moves. */ void handle_mouse(int, int, int, int, int keepmark=0); /* Handle all kinds of text field related events. */ int handletext(int e, int, int, int, int); /* Check the when() field and do a callback if indicated. */ void maybe_do_callback(Fl_Callback_Reason reason = FL_REASON_UNKNOWN); /** \internal Horizontal offset of text to left edge of widget. */ int xscroll() const {return xscroll_;} /** \internal Vertical offset of text to top edge of widget. */ int yscroll() const {return yscroll_;} void yscroll(int yOffset) { yscroll_ = yOffset; damage(FL_DAMAGE_EXPOSE);} /* Return the number of lines displayed on a single page. */ int linesPerPage(); /* Apply the current undo/redo operation, called from undo() or redo() */ int apply_undo(); public: /* Change the size of the widget. */ void resize(int, int, int, int) FL_OVERRIDE; /* Constructor */ Fl_Input_(int, int, int, int, const char* = 0); /* Destructor */ ~Fl_Input_(); /* Changes the widget text. */ int value(const char*); /* Changes the widget text. */ int value(const char*, int); /* Changes the widget text. */ int value(int value); /* Changes the widget text. */ int value(double value); /* Changes the widget text. */ int static_value(const char*); /* Changes the widget text. */ int static_value(const char*, int); /** Returns the text displayed in the widget. This function returns the current value, which is a pointer to the internal buffer and is valid only until the next event is handled. \return pointer to an internal buffer - do not free() this \see Fl_Input_::value(const char*) */ const char* value() const {return value_;} int ivalue() const; double dvalue() const; /* Returns the Unicode character at index \p i. */ unsigned int index(int i) const; /** Returns the number of bytes in value(). This may be greater than strlen(value()) if there are \c nul characters in the text. \return number of bytes in the text */ int size() const {return size_;} /** Sets the width and height of this widget. \param [in] W, H new width and height \see Fl_Widget::size(int, int) */ void size(int W, int H) { Fl_Widget::size(W, H); } /** Gets the maximum length of the input field in characters. \see maximum_size(int). */ int maximum_size() const {return maximum_size_;} /** Sets the maximum length of the input field in characters. This limits the number of characters that can be inserted in the widget. Since FLTK 1.3 this is different than the buffer size, since one character can be more than one byte in UTF-8 encoding. In FLTK 1.1 this was the same (one byte = one character). */ void maximum_size(int m) {maximum_size_ = m;} /** Gets the position of the text cursor. \return the cursor position as an index in the range 0..size() \see insert_position(int, int) */ int insert_position() const { return position_; } FL_DEPRECATED("since 1.4.0 - use insert_position() instead", int position() const ) { return insert_position(); } /** Gets the current selection mark. \return index into the text */ int mark() const {return mark_;} /* Sets the index for the cursor and mark. */ int insert_position(int p, int m); FL_DEPRECATED("since 1.4.0 - use insert_position(p, m) or Fl_Widget::position(x, y) instead", int position(int p, int m)) { return insert_position(p, m); } /** Sets the cursor position and mark. position(n) is the same as position(n, n). \param p new index for cursor and mark \return 0 if no positions changed \see insert_position(int, int), insert_position(), mark(int) */ int insert_position(int p) { return insert_position(p, p); } FL_DEPRECATED("since 1.4.0 - use insert_position(p) instead", int position(int p)) { return insert_position(p); } /** Sets the current selection mark. mark(n) is the same as insert_position(insert_position(),n). \param m new index of the mark \return 0 if the mark did not change \see insert_position(), insert_position(int, int) */ int mark(int m) {return insert_position(insert_position(), m);} /* Deletes text from \p b to \p e and inserts the new string \p text. */ int replace(int b, int e, const char *text, int ilen=0); /** Deletes the current selection. This function deletes the currently selected text \e without storing it in the clipboard. To use the clipboard, you may call copy() first or copy_cuts() after this call. \return 0 if no data was copied */ int cut() {return replace(insert_position(), mark(), 0);} /** Deletes the next \p n bytes rounded to characters before or after the cursor. This function deletes the currently selected text \e without storing it in the clipboard. To use the clipboard, you may call copy() first or copy_cuts() after this call. \param n number of bytes rounded to full characters and clamped to the buffer. A negative number will cut characters to the left of the cursor. \return 0 if no data was copied */ int cut(int n) {return replace(insert_position(), insert_position()+n, 0);} /** Deletes all characters between index \p a and \p b. This function deletes the currently selected text \e without storing it in the clipboard. To use the clipboard, you may call copy() first or copy_cuts() after this call. \param a, b range of bytes rounded to full characters and clamped to the buffer \return 0 if no data was copied */ int cut(int a, int b) {return replace(a, b, 0);} /** Inserts text at the cursor position. This function inserts the string in \p t at the cursor position() and moves the new position and mark to the end of the inserted text. \param [in] t text that will be inserted \param [in] l length of text, or 0 if the string is terminated by \c nul. \return 0 if no text was inserted */ int insert(const char* t, int l=0){return replace(position_, mark_, t, l);} /* Append text at the end. */ int append(const char* t, int l=0, char keep_selection=0); /* Put the current selection into the clipboard. */ int copy(int clipboard); /* Undo previous changes to the text buffer. */ int undo(); /* Return true if the last operation can be undone. */ bool can_undo() const; /* Redo previous undo operations. */ int redo(); /* Return true if there is a redo action in the list. */ bool can_redo() const; /* Copy the yank buffer to the clipboard. */ int copy_cuts(); /** Return the shortcut key associated with this widget. \return shortcut keystroke \see Fl_Button::shortcut() */ int shortcut() const {return shortcut_;} /** Sets the shortcut key associated with this widget. Pressing the shortcut key gives text editing focus to this widget. \param [in] s new shortcut keystroke \see Fl_Button::shortcut() */ void shortcut(int s) {shortcut_ = s;} /** Gets the font of the text in the input field. \return the current Fl_Font index */ Fl_Font textfont() const {return textfont_;} /** Sets the font of the text in the input field. The text font defaults to \c FL_HELVETICA. \param [in] s the new text font */ void textfont(Fl_Font s) {textfont_ = s;} /** Gets the size of the text in the input field. \return the text height in pixels */ Fl_Fontsize textsize() const {return textsize_;} /** Sets the size of the text in the input field. The text height defaults to \c FL_NORMAL_SIZE. \param [in] s the new font height in pixel units */ void textsize(Fl_Fontsize s) {textsize_ = s;} /** Gets the color of the text in the input field. \return the text color \see textcolor(Fl_Color) */ Fl_Color textcolor() const {return textcolor_;} /** Sets the color of the text in the input field. The text color defaults to \c FL_FOREGROUND_COLOR. \param [in] n new text color \see textcolor() */ void textcolor(Fl_Color n) {textcolor_ = n;} /** Gets the color of the cursor. \return the current cursor color */ Fl_Color cursor_color() const {return cursor_color_;} /** Sets the color of the cursor. The default color for the cursor is \c FL_BLACK. \param [in] n the new cursor color */ void cursor_color(Fl_Color n) {cursor_color_ = n;} /** Gets the input field type. \return the current input type */ int input_type() const {return type() & FL_INPUT_TYPE; } /** Sets the input field type. A redraw() is required to reformat the input field. \param [in] t new input type */ void input_type(int t) { type((uchar)(t | readonly())); } /** Gets the read-only state of the input field. \return non-zero if this widget is read-only */ int readonly() const { return type() & FL_INPUT_READONLY; } /** Sets the read-only state of the input field. \param [in] b if \p b is 0, the text in this widget can be edited by the user */ void readonly(int b) { if (b) type((uchar)(type() | FL_INPUT_READONLY)); else type((uchar)(type() & ~FL_INPUT_READONLY)); } /** Gets the word wrapping state of the input field. Word wrap is only functional with multi-line input fields. */ int wrap() const { return type() & FL_INPUT_WRAP; } /** Sets the word wrapping state of the input field. Word wrap is only functional with multi-line input fields. */ void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP)); else type((uchar)(type() & ~FL_INPUT_WRAP)); } /** Sets whether the Tab key does focus navigation, or inserts tab characters into Fl_Multiline_Input. By default this flag is enabled to provide the 'normal' behavior most users expect; Tab navigates focus to the next widget. To inserting an actual Tab character, users can use Ctrl-I or copy/paste. Disabling this flag gives the old FLTK behavior where Tab inserts a tab character into the text field, in which case only the mouse can be used to navigate to the next field. History: This flag was provided for backwards support of FLTK's old 1.1.x behavior where Tab inserts a tab character instead of navigating focus to the next widget. This behavior was unique to Fl_Multiline_Input. With the advent of Fl_Text_Editor, this old behavior has been deprecated. \param [in] val If \p val is 1, Tab advances focus (default).
    If \p val is 0, Tab inserts a tab character (old FLTK behavior). \see tab_nav(), Fl::OPTION_ARROW_FOCUS. */ void tab_nav(int val) { tab_nav_ = val; } /** Gets whether the Tab key causes focus navigation in multiline input fields or not. If enabled (default), hitting Tab causes focus navigation to the next widget. If disabled, hitting Tab inserts a tab character into the text field. \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters. \see tab_nav(int), Fl::OPTION_ARROW_FOCUS. */ int tab_nav() const { return tab_nav_; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Input_Choice.H ================================================ // // An input/chooser widget. // ______________ ____ // | || __ | // | input area || \/ | // |______________||____| // // Copyright 2004 by Greg Ercolano. // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Input_Choice widget . */ #ifndef Fl_Input_Choice_H #define Fl_Input_Choice_H #include #include #include #include /* A combination of the input widget and a menu button. The user can either type into the input area, or use the menu button chooser on the right to choose an item which loads the input area with the selected text. Note: doxygen docs in src/Fl_Input_Choice.cxx */ class FL_EXPORT Fl_Input_Choice : public Fl_Group { // Private class to handle slightly 'special' behavior of menu button class InputMenuButton : public Fl_Menu_Button { void draw() FL_OVERRIDE; const Fl_Menu_Item* popup(); public: InputMenuButton(int X, int Y, int W, int H, const char *L=0); int handle(int e) FL_OVERRIDE; }; Fl_Input *inp_; InputMenuButton *menu_; // note: this is used by the Fl_Input_Choice ctor. static void menu_cb(Fl_Widget*, void *data); // note: this is used by the Fl_Input_Choice ctor. static void inp_cb(Fl_Widget*, void *data); protected: // Custom resize behavior -- input stretches, menu button doesn't /** The methods inp_x(), inp_y(), inp_w() and inp_h() return the desired position and size of the internal Fl_Input widget. These can be overridden by a subclass to redefine positioning. See code example in the Description for subclassing details. */ virtual int inp_x() const { return(x() + Fl::box_dx(box())); } /** See inp_x() for info. */ virtual int inp_y() const { return(y() + Fl::box_dy(box())); } /** See inp_x() for info. */ virtual int inp_w() const { return(w() - Fl::box_dw(box()) - menu_w()); } /** See inp_x() for info. */ virtual int inp_h() const { return(h() - Fl::box_dh(box())); } /** The methods menu_x(), menu_y(), menu_w() and menu_h() return the desired position and size of the internal Fl_Menu_Button widget. These can be overridden by a subclass to redefine positioning. See code example in the Description for subclassing details. */ virtual int menu_x() const { return x() + w() - menu_w() - Fl::box_dx(box()); } /** See menu_x() for info. */ virtual int menu_y() const { return y() + Fl::box_dy(box()); } /** See menu_x() for info. */ virtual int menu_w() const { return 20; } /** See menu_x() for info. */ virtual int menu_h() const { return h() - Fl::box_dh(box()); } void draw() FL_OVERRIDE; public: Fl_Input_Choice(int X, int Y, int W, int H, const char *L=0); void resize(int X, int Y, int W, int H) FL_OVERRIDE; /** Adds an item to the menu. When any item is selected, the Fl_Input_Choice callback() is invoked, which can do something with the selected item. You can access the more complex Fl_Menu_Button::add() methods (setting item-specific callbacks, userdata, etc), via menubutton(). Example: \code Fl_Input_Choice *choice = new Fl_Input_Choice(100,10,120,25,"Fonts"); Fl_Menu_Button *mb = choice->menubutton(); // use Fl_Input_Choice's Fl_Menu_Button mb->add("Helvetica", 0, MyFont_CB, (void*)mydata); // use Fl_Menu_Button's add() methods mb->add("Courier", 0, MyFont_CB, (void*)mydata); mb->add("More..", 0, FontDialog_CB, (void*)mydata); \endcode */ void add(const char *s) { menu_->add(s); } /** Returns the combined changed() state of the input and menu button widget. */ int changed() const { return inp_->changed() | Fl_Widget::changed(); } // Clears the changed() state of both input and menu button widgets. void clear_changed(); // Sets the changed() state of both input and menu button widgets. void set_changed(); /** Removes all items from the menu. */ void clear() { menu_->clear(); } /** Gets the box type of the menu button */ Fl_Boxtype down_box() const { return (menu_->down_box()); } /** Sets the box type of the menu button */ void down_box(Fl_Boxtype b) { menu_->down_box(b); } /** Gets the Fl_Menu_Item array used for the menu. */ const Fl_Menu_Item *menu() { return (menu_->menu()); } /** Sets the Fl_Menu_Item array used for the menu. */ void menu(const Fl_Menu_Item *m) { menu_->menu(m); } /// Gets the Fl_Input text field's text color. Fl_Color textcolor() const { return (inp_->textcolor());} /// Sets the Fl_Input text field's text color to \p c. void textcolor(Fl_Color c) { inp_->textcolor(c);} /// Gets the Fl_Input text field's font style. Fl_Font textfont() const { return (inp_->textfont());} /// Sets the Fl_Input text field's font style to \p f. void textfont(Fl_Font f) { inp_->textfont(f);} /// Gets the Fl_Input text field's font size Fl_Fontsize textsize() const { return (inp_->textsize()); } /// Sets the Fl_Input text field's font size to \p s. void textsize(Fl_Fontsize s) { inp_->textsize(s); } /// Returns the Fl_Input text field's current contents. const char* value() const { return (inp_->value()); } /** Sets the Fl_Input text field's contents to \p val. Note it is possible to set the value() to one that is not in the menubutton's list of choices. Setting the value() does NOT affect the menubutton's selection. If that's needed, call update_menubutton() after setting value(). \see void value(int val), update_menubutton() */ void value(const char *val) { inp_->value(val); } /* Chooses item# \p val in the menu, and sets the Fl_Input text field to that value. Any previous text is cleared. */ void value(int val); int update_menubutton(); /** Returns a pointer to the internal Fl_Menu_Button widget. This can be used to access any of the methods of the menu button, e.g. \code Fl_Input_Choice *choice = new Fl_Input_Choice(100,10,120,25,"Choice:"); [..] // Print all the items in the choice menu for ( int t=0; tmenubutton()->size(); t++ ) { const Fl_Menu_Item &item = choice->menubutton()->menu()[t]; printf("item %d -- label=%s\n", t, item.label() ? item.label() : "(Null)"); } \endcode */ Fl_Menu_Button *menubutton() { return menu_; } /** Returns a pointer to the internal Fl_Input widget. This can be used to directly access all of the Fl_Input widget's methods. */ Fl_Input *input() { return inp_; } }; #endif // !Fl_Input_Choice_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Int_Input.H ================================================ // // Integer input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Int_Input widget . */ #ifndef Fl_Int_Input_H #define Fl_Int_Input_H #include "Fl_Input.H" /** The Fl_Int_Input class is a subclass of Fl_Input that only allows the user to type decimal digits (or hex numbers of the form 0xaef). */ class FL_EXPORT Fl_Int_Input : public Fl_Input { public: /** Creates a new Fl_Int_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_JPEG_Image.H ================================================ // // JPEG image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_JPEG_Image class . */ #ifndef Fl_JPEG_Image_H #define Fl_JPEG_Image_H # include "Fl_Image.H" /** The Fl_JPEG_Image class supports loading, caching, and drawing of Joint Photographic Experts Group (JPEG) File Interchange Format (JFIF) images. The class supports grayscale and color (RGB) JPEG image files. */ class FL_EXPORT Fl_JPEG_Image : public Fl_RGB_Image { public: Fl_JPEG_Image(const char *filename); Fl_JPEG_Image(const char *name, const unsigned char *data, int data_length=-1); protected: void load_jpg_(const char *filename, const char *sharename, const unsigned char *data, int data_length=-1); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Light_Button.H ================================================ // // Lighted button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Light_Button widget . */ #ifndef Fl_Light_Button_H #define Fl_Light_Button_H #include "Fl_Button.H" /** This subclass displays the "on" state by turning on a light, rather than drawing pushed in. The shape of the "light" is initially set to FL_DOWN_BOX. The color of the light when on is controlled with selection_color(), which defaults to FL_YELLOW. Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when(). \image html Fl_Light_Button.png \image latex Fl_Light_Button.png "Fl_Light_Button" width=4cm */ class FL_EXPORT Fl_Light_Button : public Fl_Button { protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Light_Button(int x,int y,int w,int h,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Line_Dial.H ================================================ // // Line dial header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Line_Dial widget . */ #ifndef Fl_Line_Dial_H #define Fl_Line_Dial_H #include "Fl_Dial.H" class FL_EXPORT Fl_Line_Dial : public Fl_Dial { public: Fl_Line_Dial(int X,int Y,int W,int H, const char *L = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu.H ================================================ // // Old menu header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // this include file is for back compatibility only #include "Fl_Menu_Item.H" ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu_.H ================================================ // // Menu base class header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Menu_ widget . */ #ifndef Fl_Menu__H #define Fl_Menu__H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif #include "Fl_Menu_Item.H" /** Base class of all widgets that have a menu in FLTK. Currently FLTK provides you with Fl_Menu_Button, Fl_Menu_Bar, and Fl_Choice. The class contains a pointer to an array of structures of type Fl_Menu_Item. The array may either be supplied directly by the user program, or it may be "private": a dynamically allocated array managed by the Fl_Menu_. When the user clicks a menu item, value() is set to that item and then: - If the Fl_Menu_Item has a callback set, that callback is invoked with any userdata configured for it. (The Fl_Menu_ widget's callback is NOT invoked.) - For any Fl_Menu_Items that \b don't have a callback set, the Fl_Menu_ widget's callback is invoked with any userdata configured for it. The callback can determine which item was picked using value(), mvalue(), item_pathname(), etc. The line spacing between menu items can be controlled with the global setting Fl::menu_linespacing(). \see Fl_Widget::shortcut_label(int) */ class FL_EXPORT Fl_Menu_ : public Fl_Widget { Fl_Menu_Item *menu_; const Fl_Menu_Item *value_; const Fl_Menu_Item *prev_value_; protected: uchar alloc; // flag indicates if menu_ is a dynamic copy (=1) or not (=0) uchar down_box_; Fl_Boxtype menu_box_; Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; int item_pathname_(char *name, int namelen, const Fl_Menu_Item *finditem, const Fl_Menu_Item *menu=0) const; public: Fl_Menu_(int,int,int,int,const char * =0); ~Fl_Menu_(); int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const; const Fl_Menu_Item* picked(const Fl_Menu_Item*); const Fl_Menu_Item* find_item(const char *name); const Fl_Menu_Item* find_item(Fl_Callback*); const Fl_Menu_Item* find_item_with_user_data(void*); const Fl_Menu_Item* find_item_with_argument(long); int find_index(const char *name) const; int find_index(const Fl_Menu_Item *item) const; int find_index(Fl_Callback *cb) const; /** Returns the menu item with the entered shortcut (key value). This searches the complete menu() for a shortcut that matches the entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT event. If a match is found, the menu's callback will be called. \return matched Fl_Menu_Item or NULL. */ const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());} void global(); /** Returns a pointer to the array of Fl_Menu_Items. This will either be the value passed to menu(value) or the private copy or an internal (temporary) location (see note below). \note Implementation details - may be changed in the future. All modifications of the menu array are done by copying the entire menu array to an internal storage for optimization of memory allocations, for instance when using add() or insert(). While this is done, menu() returns the pointer to this internal location. The entire menu will be copied back to private storage when needed, i.e. when \b another Fl_Menu_ is modified. You can force this reallocation after you're done with all menu modifications by calling Fl_Menu_::menu_end() to make sure menu() returns a permanent pointer to private storage (until the menu is modified again). Note also that some menu methods (e.g. Fl_Menu_Button::popup()) call menu_end() internally to ensure a consistent menu array while the menu is open. \see size() -- returns the size of the Fl_Menu_Item array. \see menu_end() -- finish %menu modifications (optional) \b Example: How to walk the array: \code for ( int t=0; tsize(); t++ ) { // walk array of items const Fl_Menu_Item &item = menubar->menu()[t]; // get each item fprintf(stderr, "item #%d -- label=%s, value=%s type=%s\n", t, item.label() ? item.label() : "(Null)", // menu terminators have NULL labels (item.flags & FL_MENU_VALUE) ? "set" : "clear", // value of toggle or radio items (item.flags & FL_SUBMENU) ? "Submenu" : "Item"); // see if item is a submenu or actual item } \endcode */ const Fl_Menu_Item *menu() const {return menu_;} const Fl_Menu_Item *menu_end(); // in src/Fl_Menu_add.cxx void menu(const Fl_Menu_Item *m); void copy(const Fl_Menu_Item *m, void* user_data = 0); int insert(int index, const char*, int shortcut, Fl_Callback*, void* = 0, int = 0); int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0); // see src/Fl_Menu_add.cxx /** See int Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */ int add(const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) { return add(a,fl_old_shortcut(b),c,d,e); } /** See int Fl_Menu_::insert(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */ int insert(int index, const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) { return insert(index,a,fl_old_shortcut(b),c,d,e); } int add(const char *); int size() const ; void size(int W, int H) { Fl_Widget::size(W, H); } void clear(); int clear_submenu(int index); void replace(int,const char *); void remove(int); /** Change the shortcut of item \p i to \p s. */ void shortcut(int i, int s) {menu_[i].shortcut(s);} /** Set the flags of item i. For a list of the flags, see Fl_Menu_Item. */ void mode(int i,int fl) {menu_[i].flags = fl;} /** Get the flags of item i. For a list of the flags, see Fl_Menu_Item. */ int mode(int i) const {return menu_[i].flags;} /** Return a pointer to the last menu item that was picked. */ const Fl_Menu_Item *mvalue() const {return value_;} /** Return a pointer to the menu item that was picked before the current one was picked. This call gives developers additional details how a user changed a choice in the Fl_Choice widget. */ const Fl_Menu_Item *prev_mvalue() const {return prev_value_;} // Return the index into the menu() of the last item chosen by the user or -1. int value() const; // Set the internal value_ of the menu to the given Fl_Menu_Item. int value(const Fl_Menu_Item*); /** Set the value of the menu to index \c i. The \e value of the menu is the index into the menu() of the last item chosen by the user or -1. It is \c -1 initially (if no item has been chosen) or if the chosen menu item is part of a submenu addressed by an FL_SUBMENU_POINTER. \note All menu items are located in a contiguous array of Fl_Menu_Item's unless an item has the FL_SUBMENU_POINTER flag which redirects the submenu to an independent submenu array. This submenu array is not counted in the size() of the menu, and menu items in this submenu can't return a valid index into the \b main menu. Therefore menu items that are located in such a submenu return -1 when value() is called. This may be changed in a future version. You can set the value as an integer or with a pointer to a menu item. The integer value is restricted to the main menu array (0..size()-1) whereas the menu item can be any menu item, even one in a detached submenu (see note about FL_SUBMENU_POINTER above). \param[in] i Index of the menu item in the main menu array.\n Values outside 0..size()-1 are ignored (return 0). \return Whether the new value is different than the old one. \retval 0 The value didn't change. \retval 1 The value was changed. \see int value(const Fl_Menu_Item*) \see int value() \see const Fl_Menu_Item *mvalue() */ int value(int i) { if (!menu_ || i < 0 || i >= size()) return 0; return value(menu_ + i); } /** Returns the title of the last item chosen. */ const char *text() const {return value_ ? value_->text : 0;} /** Returns the title of item i. */ const char *text(int i) const {return menu_[i].text;} /** Gets the current font of menu item labels. */ Fl_Font textfont() const {return textfont_;} /** Sets the current font of menu item labels. */ void textfont(Fl_Font c) {textfont_=c;} /** Gets the font size of menu item labels. */ Fl_Fontsize textsize() const {return textsize_;} /** Sets the font size of menu item labels. */ void textsize(Fl_Fontsize c) {textsize_=c;} /** Get the current color of menu item labels. */ Fl_Color textcolor() const {return textcolor_;} /** Sets the current color of menu item labels. */ void textcolor(Fl_Color c) {textcolor_=c;} /** This box type is used to surround the currently-selected items in the menus. */ Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;} /** Sets the box type used to surround the currently-selected items in the menus. */ void down_box(Fl_Boxtype b) {down_box_ = b;} /** Get the box type for the menu popup windows. \return the box type, or FL_NO_BOX if Fl_Menu_::box() is to be used instead */ Fl_Boxtype menu_box() const { return menu_box_; } /** Set the box type for the menu popup windows. If menu_box set to FL_NO_BOX, the menu window will use Fl_Menu_::box() instead. \param[in] b new box type or FL_NO_BOX */ void menu_box(Fl_Boxtype b) { menu_box_ = b; } /** For back compatibility, same as selection_color() */ Fl_Color down_color() const {return selection_color();} /** For back compatibility, same as selection_color() */ void down_color(unsigned c) {selection_color(c);} void setonly(Fl_Menu_Item* item); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu_Bar.H ================================================ // // Menu bar header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Menu_Bar widget . */ #ifndef Fl_Menu_Bar_H #define Fl_Menu_Bar_H #include "Fl_Menu_.H" /** This widget provides a standard menubar interface. Usually you will put this widget along the top edge of your window. The height of the widget should be 30 for the menu titles to draw correctly with the default font. The items on the bar and the menus they bring up are defined by a single Fl_Menu_Item array. Because a Fl_Menu_Item array defines a hierarchy, the top level menu defines the items in the menubar, while the submenus define the pull-down menus. Sub-sub menus and lower pop up to the right of the submenus. \image html menubar.png \image latex menubar.png " menubar" width=12cm If there is an item in the top menu that is not a title of a submenu, then it acts like a "button" in the menubar. Clicking on it will pick it. When the user clicks a menu item, value() is set to that item and then: - The item's callback is done if one has been set; the Fl_Menu_Bar is passed as the Fl_Widget* argument, along with any userdata configured for the callback. - If the item does not have a callback, the Fl_Menu_Bar's callback is done instead, along with any userdata configured for the callback. The callback can determine which item was picked using value(), mvalue(), item_pathname(), etc. Submenus will also pop up in response to shortcuts indicated by putting a '&' character in the name field of the menu item. If you put a '&' character in a top-level "button" then the shortcut picks it. The '&' character in submenus is ignored until the menu is popped up. Typing the shortcut() of any of the menu items will cause callbacks exactly the same as when you pick the item with the mouse. */ class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ { friend class Fl_Sys_Menu_Bar_Driver; protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; /** Creates a new Fl_Menu_Bar widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. The constructor sets menu() to NULL. See Fl_Menu_ for the methods to set or change the menu. labelsize(), labelfont(), and labelcolor() are used to control how the menubar items are drawn. They are initialized from the Fl_Menu static variables, but you can change them if desired. label() is ignored unless you change align() to put it outside the menubar. The destructor removes the Fl_Menu_Bar widget and all of its menu items. */ Fl_Menu_Bar(int X, int Y, int W, int H, const char *l=0); /** Updates the menu bar after any change to its items. This is useful when the menu bar can be an Fl_Sys_Menu_Bar object. */ virtual void update() {} /** Opens the 1st level submenu of the menubar corresponding to \c item. \since 1.4.0 */ virtual void play_menu(const Fl_Menu_Item *item); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu_Button.H ================================================ // // Menu button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Menu_Button widget . */ #ifndef Fl_Menu_Button_H #define Fl_Menu_Button_H #include "Fl_Menu_.H" /** This is a button that when pushed pops up a menu (or hierarchy of menus) defined by an array of Fl_Menu_Item objects. \image html menu_button.png \image latex menu_button.png " menu_button" width=5cm

    Normally any mouse button will pop up a menu and it is lined up below the button as shown in the picture. However an Fl_Menu_Button may also control a pop-up menu. This is done by setting the type(). If type() is zero a normal menu button is produced. If it is nonzero then this is a pop-up menu. The bits in type() indicate what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons).

    The menu will also pop up in response to shortcuts indicated by putting a '&' character in the label().

    Typing the shortcut() of any of the menu items will cause callbacks exactly the same as when you pick the item with the mouse. The '&' character in menu item names are only looked at when the menu is popped up, however.

    When the user clicks a menu item, value() is set to that item and then: - The item's callback is done if one has been set; the Fl_Menu_Button is passed as the Fl_Widget* argument, along with any userdata configured for the callback. - If the item does not have a callback, the Fl_Menu_Button's callback is done instead, along with any userdata configured for it. The callback can determine which item was picked using value(), mvalue(), item_pathname(), etc. */ class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ { protected: void draw() FL_OVERRIDE; static Fl_Menu_Button* pressed_menu_button_; public: /** \brief indicate what mouse buttons pop up the menu. Values for type() used to indicate what mouse buttons pop up the menu. Fl_Menu_Button::POPUP3 is usually what you want. */ enum popup_buttons {POPUP1 = 1, /**< pops up with the mouse 1st button. */ POPUP2, /**< pops up with the mouse 2nd button. */ POPUP12, /**< pops up with the mouse 1st or 2nd buttons. */ POPUP3, /**< pops up with the mouse 3rd button. */ POPUP13, /**< pops up with the mouse 1st or 3rd buttons. */ POPUP23, /**< pops up with the mouse 2nd or 3rd buttons. */ POPUP123 /**< pops up with any mouse button. */ }; int handle(int) FL_OVERRIDE; const Fl_Menu_Item* popup(); Fl_Menu_Button(int,int,int,int,const char * =0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu_Item.H ================================================ // // Menu item header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Menu_Item_H #define Fl_Menu_Item_H #include #include #include #include // for FL_COMMAND and FL_CONTROL // doxygen needs the following line to enable e.g. ::FL_MENU_TOGGLE to link to the enums /// @file enum { // values for flags: FL_MENU_INACTIVE = 1, ///< Deactivate menu item (gray out) FL_MENU_TOGGLE = 2, ///< Item is a checkbox toggle (shows checkbox for on/off state) FL_MENU_VALUE = 4, ///< The on/off state for checkbox/radio buttons (if set, state is 'on') FL_MENU_RADIO = 8, ///< Item is a radio button (one checkbox of many can be on) FL_MENU_INVISIBLE = 0x10, ///< Item will not show up (shortcut will work) FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array FL_SUBMENU = 0x40, ///< Item is a submenu to other items FL_MENU_DIVIDER = 0x80, ///< Creates divider line below this item. Also ends a group of radio buttons FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved, internal (do not use) ///< Note: \b ALL other bits in \p flags are reserved: do not use them for your own purposes! }; extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*); class Fl_Menu_; /** The Fl_Menu_Item structure defines a single menu item that is used by the Fl_Menu_ class. \code struct Fl_Menu_Item { const char* text; // label() int shortcut_; Fl_Callback* callback_; void* user_data_; int flags; uchar labeltype_; uchar labelfont_; uchar labelsize_; uchar labelcolor_; }; enum { // values for flags: FL_MENU_INACTIVE = 1, // Deactivate menu item (gray out) FL_MENU_TOGGLE = 2, // Item is a checkbox toggle (shows checkbox for on/off state) FL_MENU_VALUE = 4, // The on/off state for checkbox/radio buttons (if set, state is 'on') FL_MENU_RADIO = 8, // Item is a radio button (one checkbox of many can be on) FL_MENU_INVISIBLE = 0x10, // Item will not show up (shortcut will work) FL_SUBMENU_POINTER = 0x20, // Indicates user_data() is a pointer to another menu array FL_SUBMENU = 0x40, // This item is a submenu to other items FL_MENU_DIVIDER = 0x80, // Creates divider line below this item. Also ends a group of radio buttons. FL_MENU_HORIZONTAL = 0x100 // ??? -- reserved, internal (do not use) }; \endcode \note \b All other bits in \p flags are reserved for FLTK usage, do not use any bits of the \p flags variable for your own purposes. Even \b undocumented bits can be used for internal purposes in this or any future FLTK version. Some \p flags bits may be changed during runtime by user code, particularly if you need to change the value of a menu item (ON/OFF) or make it active or inactive. Such changes must be done with caution so they don't affect other (maybe undocumented) bits, i.e. you need to make proper bit operations to set or clear only these particular bits. Typically menu items are statically defined; for example: \code Fl_Menu_Item popup[] = { {"&alpha", FL_ALT+'a', the_cb, (void*)1}, {"&beta", FL_ALT+'b', the_cb, (void*)2}, {"gamma", FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER}, {"&strange", 0, strange_cb}, {"&charm", 0, charm_cb}, {"&truth", 0, truth_cb}, {"b&eauty", 0, beauty_cb}, {"sub&menu", 0, 0, 0, FL_SUBMENU}, {"one"}, {"two"}, {"three"}, {0}, {"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER}, {"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE}, {"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE}, {"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE}, {0}}; \endcode produces: \image html menu.png \image latex menu.png "menu" width=10cm A submenu title is identified by the bit FL_SUBMENU in the flags field, and ends with a label() that is NULL. You can nest menus to any depth. A pointer to the first item in the submenu can be treated as an Fl_Menu array itself. It is also possible to make separate submenu arrays with FL_SUBMENU_POINTER flags. You should use the method functions to access structure members and not access them directly to avoid compatibility problems with future releases of FLTK. \note Adding menu items with insert(), add(), or any of its overloaded variants copies the entire menu to internal storage. Using the memory of a static menu array after that would access unused (but not released) memory and thus have no effect. */ struct FL_EXPORT Fl_Menu_Item { const char *text; ///< menu item text, returned by label() int shortcut_; ///< menu item shortcut Fl_Callback *callback_; ///< menu item callback void *user_data_; ///< menu item user_data for the menu's callback int flags; ///< menu item flags like FL_MENU_TOGGLE, FL_MENU_RADIO uchar labeltype_; ///< how the menu item text looks like Fl_Font labelfont_; ///< which font for this menu item text Fl_Fontsize labelsize_; ///< size of menu item text Fl_Color labelcolor_; ///< menu item text color // advance N items, skipping submenus: const Fl_Menu_Item *next(int=1) const; /** Advances a pointer by n items through a menu array, skipping the contents of submenus and invisible items. There are two calls so that you can advance through const and non-const data. */ Fl_Menu_Item *next(int i=1) { return (Fl_Menu_Item*)(((const Fl_Menu_Item*)this)->next(i));} /** Returns the first menu item, same as next(0). */ const Fl_Menu_Item *first() const { return next(0); } /** Returns the first menu item, same as next(0). */ Fl_Menu_Item *first() { return next(0); } // methods on menu items: /** Returns the title (label) of the menu item. A NULL here indicates the end of the menu (or of a submenu). A '&' in the item will print an underscore under the next letter, and if the menu is popped up that letter will be a "shortcut" to pick that item. To get a real '&' put two in a row. The returned value depends on the labeltype() that has been used to store the label. \returns A pointer to the label cast to (const char *) \retval (a) A pointer to text (const char *) \retval (b) A pointer to an image (Fl_Image *) \retval (c) A pointer to a "multi label" (Fl_Multi_Label *) \retval NULL End of menu or submenu \see Fl_Menu_Item::label(const char *) \see Fl_Menu_Item::label(Fl_Labeltype, const char *) \see Fl_Menu_Item::image_label(const Fl_Image *) \see Fl_Menu_Item::multi_label(const Fl_Multi_Label *) \see Fl_Multi_Label::label(Fl_Menu_Item *) */ const char* label() const { return text; } /** Sets the title (label) of the menu item. \note This does \b not change the labeltype() for backwards compatibility. Take care to assign the correct labeltype() if you assign different label types to the same menu item sequentially. The default labeltype() is FL_NORMAL_LABEL. \see label(Fl_Labeltype, const char*) \see const char* Fl_Menu_Item::label() const */ void label(const char* a) { text = a; } /** Sets the title (label) and the label type of the menu item. The default Fl_Labeltype when using Fl_Menu_Item::label(const char* a) is FL_NORMAL_LABEL but you can set any other label type, for instance FL_EMBOSSED_LABEL. Special labeltypes are: - FL_ICON_LABEL: draws the icon (Fl_Image) associated with the text - FL_IMAGE_LABEL: draws the image (Fl_Image) associated with the text - FL_MULTI_LABEL: draws multiple parts side by side, see Fl_Multi_Label \see const char* Fl_Menu_Item::label() const */ void label(Fl_Labeltype a, const char* b) { labeltype_ = a; text = b; } /** Sets the title (label()) and labeltype() to an Fl_Multi_Label. This sets the labeltype() to \_FL_MULTI_LABEL (note the leading underscore). \see const char* Fl_Menu_Item::label() const \since 1.4.0 \internal Overloading Fl_Menu_Item::image() would lead to ambiguities when used like `item->label(0)`, hence we need our own method name. Otherwise existing programs might not compile w/o error (e.g. fluid). */ void multi_label(const Fl_Multi_Label *ml) { label(FL_MULTI_LABEL, (const char *)ml); } /** Sets the title (label()) to an icon or image. This sets the labeltype() to \_FL_IMAGE_LABEL (note the leading underscore). \see const char* Fl_Menu_Item::label() const \since 1.4.0 \internal Overloading Fl_Menu_Item::image() would lead to ambiguities when used like `item->label(0)`, hence we need our own method name. Otherwise existing programs might not compile w/o error (e.g. fluid). */ void image_label(const Fl_Image *image) { label(FL_IMAGE_LABEL, (const char *)image); } /** Returns the menu item's labeltype. A labeltype identifies a routine that draws the label of the widget. This can be used for special effects such as emboss, or to use the label() pointer as another form of data such as a bitmap. The value FL_NORMAL_LABEL prints the label as text. */ Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;} /** Sets the menu item's labeltype. A labeltype identifies a routine that draws the label of the widget. This can be used for special effects such as emboss, or to use the label() pointer as another form of data such as a bitmap. The value FL_NORMAL_LABEL prints the label as text. */ void labeltype(Fl_Labeltype a) {labeltype_ = a;} /** Gets the menu item's label color. This color is passed to the labeltype routine, and is typically the color of the label text. This defaults to FL_BLACK. If this color is not black fltk will \b not use overlay bitplanes to draw the menu - this is so that images put in the menu draw correctly. */ Fl_Color labelcolor() const {return labelcolor_;} /** Sets the menu item's label color. \see Fl_Color Fl_Menu_Item::labelcolor() const */ void labelcolor(Fl_Color a) {labelcolor_ = a;} /** Gets the menu item's label font. Fonts are identified by small 8-bit indexes into a table. See the enumeration list for predefined fonts. The default value is a Helvetica font. The function Fl::set_font() can define new fonts. */ Fl_Font labelfont() const {return labelfont_;} /** Sets the menu item's label font. Fonts are identified by small 8-bit indexes into a table. See the enumeration list for predefined fonts. The default value is a Helvetica font. The function Fl::set_font() can define new fonts. */ void labelfont(Fl_Font a) {labelfont_ = a;} /** Gets the label font pixel size/height. */ Fl_Fontsize labelsize() const {return labelsize_;} /** Sets the label font pixel size/height.*/ void labelsize(Fl_Fontsize a) {labelsize_ = a;} /** Returns the callback function that is set for the menu item. Each item has space for a callback function and an argument for that function. Due to back compatibility, the Fl_Menu_Item itself is not passed to the callback, instead you have to get it by calling ((Fl_Menu_*)w)->mvalue() where w is the widget argument. */ Fl_Callback_p callback() const {return callback_;} /** Sets the menu item's callback function and userdata() argument. \see Fl_Callback_p Fl_MenuItem::callback() const */ void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;} /** Sets the menu item's callback function. This method does not set the userdata() argument. \see Fl_Callback_p Fl_MenuItem::callback() const */ void callback(Fl_Callback* c) {callback_=c;} /** Sets the menu item's callback function. This method does not set the userdata() argument. \see Fl_Callback_p Fl_MenuItem::callback() const */ void callback(Fl_Callback0 *c) { callback_ = (Fl_Callback *)(void *)c; } /** Sets the menu item's callback function and userdata() argument. The argument \p is cast to void* and stored as the userdata() for the menu item's callback function. \see Fl_Callback_p Fl_MenuItem::callback() const */ void callback(Fl_Callback1 *c, long p = 0) { callback_ = (Fl_Callback *)(void *)c; user_data_ = (void *)(fl_intptr_t)p; } /** Gets the user_data() argument that is sent to the callback function. */ void* user_data() const {return user_data_;} /** Sets the user_data() argument that is sent to the callback function. */ void user_data(void* v) {user_data_ = v;} /** Gets the user_data() argument that is sent to the callback function. For convenience you can also define the callback as taking a long argument. This method casts the stored userdata() argument to long and returns it as a \e long value. */ long argument() const {return (long)(fl_intptr_t)user_data_;} /** Sets the user_data() argument that is sent to the callback function. For convenience you can also define the callback as taking a long argument. This method casts the given argument \p v to void* and stores it in the menu item's userdata() member. This may not be portable to some machines. */ void argument(long v) {user_data_ = (void*)(fl_intptr_t)v;} /** Gets what key combination shortcut will trigger the menu item. */ int shortcut() const {return shortcut_;} /** Sets exactly what key combination will trigger the menu item. The value is a logical 'or' of a key and a set of shift flags, for instance FL_ALT+'a' or FL_ALT+FL_F+10 or just 'a'. A value of zero disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift flags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift flags (zero for the other bits indicates a "don't care" setting). */ void shortcut(int s) {shortcut_ = s;} /** Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER is on in the flags. FL_SUBMENU indicates an embedded submenu that goes from the next item through the next one with a NULL label(). FL_SUBMENU_POINTER indicates that user_data() is a pointer to another menu array. */ int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);} /** Returns true if a checkbox will be drawn next to this item. This is true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags. */ int checkbox() const {return flags&FL_MENU_TOGGLE;} /** Returns true if this item is a radio item. When a radio button is selected all "adjacent" radio buttons are turned off. A set of radio items is delimited by an item that has radio() false, or by an item with FL_MENU_DIVIDER turned on. */ int radio() const {return flags&FL_MENU_RADIO;} /** Returns the current value of the check or radio item. This is zero (0) if the menu item is not checked and non-zero otherwise. \since 1.4.0 this method returns 1 if the item is checked but you should not rely on a particular value, only zero or non-zero. \note The returned value for a checked menu item was FL_MENU_VALUE (4) before FLTK 1.4.0. */ int value() const {return (flags & FL_MENU_VALUE) ? 1 : 0;} /** Sets the current value of the check or radio item. */ void value(int v) { v ? set() : clear(); } /** Turns the check or radio item "on" for the menu item. Note that this does not turn off any adjacent radio items like setonly() does. */ void set() {flags |= FL_MENU_VALUE;} /** Turns the check or radio item "off" for the menu item. */ void clear() {flags &= ~FL_MENU_VALUE;} void setonly(Fl_Menu_Item const* first = NULL); /** Gets the visibility of an item. */ int visible() const {return !(flags&FL_MENU_INVISIBLE);} /** Makes an item visible in the menu. */ void show() {flags &= ~FL_MENU_INVISIBLE;} /** Hides an item in the menu. */ void hide() {flags |= FL_MENU_INVISIBLE;} /** Gets whether or not the item can be picked. */ int active() const {return !(flags&FL_MENU_INACTIVE);} /** Allows a menu item to be picked. */ void activate() {flags &= ~FL_MENU_INACTIVE;} /** Prevents a menu item from being picked. Note that this will also cause the menu item to appear grayed-out. */ void deactivate() {flags |= FL_MENU_INACTIVE;} /** Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise. */ int activevisible() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE));} // compatibility for FLUID so it can set the image of a menu item... /** Compatibility API for FLUID, same as image->label(this). \note This method is intended for internal use by fluid and may not do what you expect. */ void image(Fl_Image* image) {image->label(this);} /** Compatibility API for FLUID, same as image.label(this). \note This method is intended for internal use by fluid and may not do what you expect. */ void image(Fl_Image& image) {image.label(this);} // used by menubar: int measure(int* h, const Fl_Menu_*) const; void draw(int x, int y, int w, int h, const Fl_Menu_*, int t=0) const; // popup menus without using an Fl_Menu_ widget: const Fl_Menu_Item* popup( int X, int Y, const char *title = 0, const Fl_Menu_Item* picked=0, const Fl_Menu_* = 0) const; const Fl_Menu_Item* pulldown( int X, int Y, int W, int H, const Fl_Menu_Item* picked = 0, const Fl_Menu_* = 0, const Fl_Menu_Item* title = 0, int menubar=0) const; const Fl_Menu_Item* test_shortcut() const; const Fl_Menu_Item* find_shortcut(int *ip=0, const bool require_alt = false) const; /** Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument. The callback is called with the stored user_data() as its second argument. You must first check that callback() is non-zero before calling this. */ void do_callback(Fl_Widget* o) const {Fl::callback_reason_=FL_REASON_SELECTED; callback_(o, user_data_);} /** Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument. This call overrides the callback's second argument with the given value \p arg. You must first check that callback() is non-zero before calling this. */ void do_callback(Fl_Widget* o,void* arg) const {Fl::callback_reason_=FL_REASON_SELECTED; callback_(o, arg);} /** Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument. This call overrides the callback's second argument with the given value \p arg. long \p arg is cast to void* when calling the callback. You must first check that callback() is non-zero before calling this. */ void do_callback(Fl_Widget* o,long arg) const {Fl::callback_reason_=FL_REASON_SELECTED; callback_(o, (void*)(fl_intptr_t)arg);} /** Back compatibility only. \deprecated Please use Fl_Menu_Item::value() instead. This method will be removed in FLTK 1.5.0 or later. \see value() */ inline int checked() const {return value();} /** Back compatibility only. \deprecated Please use Fl_Menu_Item::set() instead. This method will be removed in FLTK 1.5.0 or later. \see set() */ inline void check() {set();} /** Back compatibility only. \deprecated Please use Fl_Menu_Item::clear() instead. This method will be removed in FLTK 1.5.0 or later. \see clear() */ inline void uncheck() {clear();} int insert(int,const char*,int,Fl_Callback*,void* =0, int =0); int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0); /** See int add(const char*, int shortcut, Fl_Callback*, void*, int) */ int add(const char*a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) { return add(a,fl_old_shortcut(b),c,d,e);} int size() const ; }; typedef Fl_Menu_Item Fl_Menu; // back compatibility enum { // back-compatibility enum: FL_PUP_NONE = 0, FL_PUP_GREY = FL_MENU_INACTIVE, FL_PUP_GRAY = FL_MENU_INACTIVE, FL_MENU_BOX = FL_MENU_TOGGLE, FL_PUP_BOX = FL_MENU_TOGGLE, FL_MENU_CHECK = FL_MENU_VALUE, FL_PUP_CHECK = FL_MENU_VALUE, FL_PUP_RADIO = FL_MENU_RADIO, FL_PUP_INVISIBLE = FL_MENU_INVISIBLE, FL_PUP_SUBMENU = FL_SUBMENU_POINTER }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Menu_Window.H ================================================ // // Menu window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Menu_Window widget . */ #ifndef Fl_Menu_Window_H #define Fl_Menu_Window_H #include "Fl_Single_Window.H" /** The Fl_Menu_Window widget is a window type used for menus. By default the window is drawn in the hardware overlay planes if they are available so that the menu don't force the rest of the window to redraw. */ class FL_EXPORT Fl_Menu_Window : public Fl_Single_Window { public: ~Fl_Menu_Window(); /** Creates a new Fl_Menu_Window widget using the given size, and label string. */ Fl_Menu_Window(int W, int H, const char *l = 0); /** Creates a new Fl_Menu_Window widget using the given position, size, and label string. */ Fl_Menu_Window(int X, int Y, int W, int H, const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Multi_Browser.H ================================================ // // Multi browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Multi_Browser widget . */ #ifndef Fl_Multi_Browser_H #define Fl_Multi_Browser_H #include "Fl_Browser.H" /** The Fl_Multi_Browser class is a subclass of Fl_Browser which lets the user select any set of the lines. \image html fl_multi_browser.png "Fl_Multi_Browser" \image latex fl_multi_browser.png "Fl_Multi_Browser" width=4cm The user interface is Macintosh style: clicking an item turns off all the others and selects that one, dragging selects all the items the mouse moves over, and ctrl + click (Cmd+click on the Mac OS platform) toggles the items. Shift + click extends the selection until the clicked item. This is different from how forms did it. Normally the callback is done when the user releases the mouse, but you can change this with when().

    See Fl_Browser for methods to add and remove lines from the browser. */ class FL_EXPORT Fl_Multi_Browser : public Fl_Browser { public: /** Creates a new Fl_Multi_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. */ Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Multi_Label.H ================================================ // // Multi-label header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Multi_Label_H #define Fl_Multi_Label_H class Fl_Widget; struct Fl_Menu_Item; /** Allows a mixed text and/or graphics label to be applied to an Fl_Menu_Item or Fl_Widget. Most regular FLTK widgets now support the ability to associate both images and text with a label but some special cases, notably the non-widget Fl_Menu_Item objects, do not. Fl_Multi_Label may be used to create menu items that have an icon and text, which would not normally be possible for an Fl_Menu_Item. For example, Fl_Multi_Label is used in the New->Code submenu in fluid, and others. \image html Fl_Multi_Label-menu-item.png "Menu items with icons using Fl_Multi_Label" \image latex Fl_Multi_Label-menu-item.png "Menu items with icons using Fl_Multi_Label" width=4cm Each Fl_Multi_Label holds two elements, \p labela and \p labelb; each may hold either a text label (const char*) or an image (Fl_Image*). When displayed, \p labela is drawn first and \p labelb is drawn immediately to its right. More complex labels can be constructed by setting labelb as another Fl_Multi_Label and thus chaining up a series of label elements. When assigning a label element to one of \p labela or \p labelb, they should be explicitly cast to (const char*) if they are not of that type already. \note An Fl_Multi_Label object and all its components (label text, images, chained Fl_Multi_Label's and their linked objects) must exist during the lifetime of the widget or menu item they are assigned to. It is the responsibility of the user's code to release these linked objects if necessary after the widget or menu is deleted. Example Use: Fl_Menu_Bar \code Fl_Pixmap *image = new Fl_Pixmap(..); // image for menu item; any Fl_Image based widget Fl_Menu_Bar *menu = new Fl_Menu_Bar(..); // can be any Fl_Menu_ oriented widget (Fl_Choice, Fl_Menu_Button..) // Create a menu item int i = menu->add("File/New", ..); Fl_Menu_Item *item = (Fl_Menu_Item*)&(menu->menu()[i]); // Create a multi label, assign it an image + text Fl_Multi_Label *ml = new Fl_Multi_Label; // Left side of label is an image ml->typea = FL_IMAGE_LABEL; ml->labela = (const char*)image; // any Fl_Image widget: Fl_Pixmap, Fl_PNG_Image, etc.. // Right side of label is label text ml->typeb = FL_NORMAL_LABEL; ml->labelb = item->label(); // Assign the multilabel to the menu item // ml->label(item); // deprecated since 1.4.0; backwards compatible with 1.3.x item->label(ml); // new method since 1.4.0 \endcode \see Fl_Label and Fl_Labeltype and examples/howto-menu-with-images.cxx */ struct FL_EXPORT Fl_Multi_Label { /** Holds the "leftmost" of the two elements in the composite label. Typically this would be assigned either a text string (const char*), a (Fl_Image*) or a (Fl_Multi_Label*). */ const char* labela; /** Holds the "rightmost" of the two elements in the composite label. Typically this would be assigned either a text string (const char*), a (Fl_Image*) or a (Fl_Multi_Label*). */ const char* labelb; /** Holds the "type" of labela. Typically this is set to FL_NORMAL_LABEL for a text label, FL_IMAGE_LABEL for an image (based on Fl_image) or FL_MULTI_LABEL if "chaining" multiple Fl_Multi_Label elements together. */ uchar typea; /** Holds the "type" of labelb. Typically this is set to FL_NORMAL_LABEL for a text label, FL_IMAGE_LABEL for an image (based on Fl_image) or FL_MULTI_LABEL if "chaining" multiple Fl_Multi_Label elements together. */ uchar typeb; // This method is used to associate a Fl_Multi_Label with a Fl_Widget. void label(Fl_Widget*); // This method is used to associate a Fl_Multi_Label with a Fl_Menu_Item. void label(Fl_Menu_Item*); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Multiline_Input.H ================================================ // // Multiline input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Multiline_Input widget . */ #ifndef Fl_Multiline_Input_H #define Fl_Multiline_Input_H #include "Fl_Input.H" /** This input field displays '\\n' characters as new lines rather than ^J, and accepts the Return, Tab, and up and down arrow keys. This is for editing multiline text. This is far from the nirvana of text editors, and is probably only good for small bits of text, 10 lines at most. Note that this widget does not support scrollbars or per-character color control. If you are presenting large amounts of text and need scrollbars or full color control of characters, you probably want Fl_Text_Editor instead. In FLTK 1.3.x, the default behavior of the 'Tab' key was changed to support consistent focus navigation. To get the older FLTK 1.1.x behavior, set Fl_Input_::tab_nav() to 0. Newer programs should consider using Fl_Text_Editor. */ class FL_EXPORT Fl_Multiline_Input : public Fl_Input { public: /** Creates a new Fl_Multiline_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Multiline_Output.H ================================================ // // Multi line output header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Multiline_Output widget . */ #ifndef Fl_Multiline_Output_H #define Fl_Multiline_Output_H #include "Fl_Output.H" /** This widget is a subclass of Fl_Output that displays multiple lines of text. It also displays tab characters as whitespace to the next column. Note that this widget does not support scrollbars, or per-character color control. If you are presenting large amounts of read-only text and need scrollbars, or full color control of characters, then use Fl_Text_Display. If you want to display HTML text, use Fl_Help_View. A caret cursor (^) shows the keyboard navigation mark for keyboard selection of the output text, e.g. Arrow Keys to move the cursor, Shift + Arrow Keys to create a text selection, and '^C' to copy the selected text to the paste buffer. The caret cursor can be disabled by disabling the widget's "visible focus" using clear_visible_focus(), inherited from the Fl_Widget base class. Doing this also disables the widget's keyboard navigation. */ class FL_EXPORT Fl_Multiline_Output : public Fl_Output { public: /** Creates a new Fl_Multiline_Output widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Native_File_Chooser.H ================================================ // // FLTK native OS file chooser widget // // Copyright 2004 Greg Ercolano. // Copyright 2005-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Native_File_Chooser widget. */ /* Implementation note: class Fl_Native_File_Chooser <== public API used by applications class Fl_Native_File_Chooser_Driver <== virtual API that a platform may implement this API has a do-nothing default implementation class Fl_Native_File_Chooser_FLTK_Driver <== this API implementation is the default FLTK file chooser class Fl_GTK_Native_File_Chooser_Driver <== this API implementation runs a GTK file chooser class Fl_Kdialog_Native_File_Chooser_Driver <== this API implementation runs a KDE file chooser it is determined at run-time if the GTK dynamic libraries are available and the KDE file chooser runs under the KDE desktop class Fl_Quartz_Native_File_Chooser_Driver <== this API implementation runs a Mac OS X file chooser class Fl_WinAPI_Native_File_Chooser_Driver <== this API implementation runs a Windows file chooser Each platform must implement the constructor of the Fl_Native_File_Chooser class. This particular implementation: Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val); } can be used by any platform. No more code is required. The cross-platform Fl_Native_File_Chooser_FLTK.cxx file must be compiled in libfltk, and the default FLTK file chooser will be used. This other implementation: Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { platform_fnfc = 0; } can be used by a platform that needs no file chooser. */ #ifndef FL_NATIVE_FILE_CHOOSER_H #define FL_NATIVE_FILE_CHOOSER_H #include #include class Fl_Native_File_Chooser_Driver; /** This class lets an FLTK application easily and consistently access the operating system's native file chooser. Some operating systems have very complex and specific file choosers that many users want access to specifically, instead of FLTK's default file chooser(s). In cases where there is no native file browser, FLTK's own file browser is used instead. To use this widget, use the following include in your code: \code #include \endcode The following example shows how to pick a single file: \code // Create and post the local native file chooser #include [..] Fl_Native_File_Chooser fnfc; fnfc.title("Pick a file"); fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); fnfc.filter("Text\t*.txt\n" "C Files\t*.{cxx,h,c}"); fnfc.directory("/var/tmp"); // default directory to use // Show native chooser switch ( fnfc.show() ) { case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR case 1: printf("CANCEL\n"); break; // CANCEL default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN } \endcode The Fl_Native_File_Chooser widget transmits UTF-8 encoded filenames to its user. It is recommended to open files that may have non-ASCII names with the fl_fopen() or fl_open() utility functions that handle these names in a cross-platform way (whereas the standard fopen()/open() functions fail on the Windows platform to open files with a non-ASCII name). Platform Specific Caveats - Under X11/Wayland the dialog is chosen as follows: -# If command \p zenity is available at run-time and if \p Fl::option(OPTION_FNFC_USES_ZENITY) is turned on, the \p zenity -based dialog opens. This is expected to be more appropriate than other dialog forms for sandboxed apps, but member function filter_value() is not effective. -# Else if the app runs under the KDE desktop and if \p Fl::option(OPTION_FNFC_USES_KDIALOG) is turned on, and if command \p kdialog is available at run-time, the \p kdialog -based dialog opens. Member function filter_value() is not effective with this dialog. -# Else if the GTK library is available at run-time on the computer and if \p Fl::option(OPTION_FNFC_USES_GTK) is not turned off, the GTK-styled dialog opens. Call fl_register_images() to add a "Preview" button to this dialog. Use the static public attributes of class Fl_File_Chooser to localize the browser. -# Otherwise, FLTK's own dialog produced by the Fl_File_Chooser class opens. Call fl_register_images() to add a "Preview" button to it. It's best if you also call Fl_File_Icon::load_system_icons() at the start of main(), to enable the nicer looking file browser widgets. Use the static public attributes of class Fl_File_Chooser to localize the browser. - Some operating systems support certain OS specific options; see Fl_Native_File_Chooser::options() for a list. \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms." \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm */ class FL_EXPORT Fl_Native_File_Chooser { private: Fl_Native_File_Chooser_Driver *platform_fnfc; public: enum Type { BROWSE_FILE = 0, ///< browse files (lets user choose one file) BROWSE_DIRECTORY, ///< browse directories (lets user choose one directory) BROWSE_MULTI_FILE, ///< browse files (lets user choose multiple files) BROWSE_MULTI_DIRECTORY, ///< browse directories (lets user choose multiple directories) BROWSE_SAVE_FILE, ///< browse to save a file BROWSE_SAVE_DIRECTORY ///< browse to save a directory }; enum Option { NO_OPTIONS = 0x0000, ///< no options enabled SAVEAS_CONFIRM = 0x0001, ///< Show native 'Save As' overwrite confirm dialog NEW_FOLDER = 0x0002, ///< Show 'New Folder' icon (if supported) PREVIEW = 0x0004, ///< enable preview mode (if supported) USE_FILTER_EXT = 0x0008 ///< Chooser filter presets the output file extension (if supported) }; static const char *file_exists_message; /** The constructor. Internally allocates the native widgets. Optional \p val presets the type of browser this will be, which can also be changed with type(). */ Fl_Native_File_Chooser(int val = BROWSE_FILE); // each platorm implements it ~Fl_Native_File_Chooser(); void type(int t); int type() const ; void options(int o); int options() const; int count() const; const char *filename() const ; const char *filename(int i) const ; void directory(const char *val) ; const char *directory() const; void title(const char *t); const char* title() const; const char *filter() const ; void filter(const char *f); int filters() const ; void filter_value(int i) ; int filter_value() const ; void preset_file(const char*f) ; const char* preset_file() const; const char *errmsg() const ; int show() ; }; /** \cond DriverDev \addtogroup DriverDeveloper \{ */ /** Represents the interface between FLTK and a native file chooser. This class is only for internal use by the FLTK library. A platform that wants to provide a native file chooser implements all virtual methods of this class. Each platform supported by FLTK must also implement the constructor of the Fl_Native_File_Chooser class. */ class Fl_Native_File_Chooser_Driver { protected: static void chrcat(char *s, char c); static char *strapp(char *s, const char *val); static char *strfree(char *val); static char *strnew(const char *val); public: Fl_Native_File_Chooser_Driver(int) {} virtual ~Fl_Native_File_Chooser_Driver() {} virtual void type(int) {} virtual int type() const {return 0;} virtual void options(int) {} virtual int options() const {return 0;} virtual int count() const {return 0;} virtual const char *filename() const {return 0;} virtual const char *filename(int) const {return 0;} virtual void directory(const char *) {} virtual const char *directory() const {return 0;} virtual void title(const char *) {} virtual const char* title() const {return 0;} virtual const char *filter() const {return 0;} virtual void filter(const char *) {} virtual int filters() const {return 0;} virtual void filter_value(int) {} virtual int filter_value() const {return 0;} virtual void preset_file(const char*) {} virtual const char* preset_file() const {return 0;} virtual const char *errmsg() const {return 0;} virtual int show() {return 1;} }; /** A cross-platform implementation of Fl_Native_File_Chooser_Driver. This implementation uses a Fl_File_Chooser object as file chooser. Any platform can support the Fl_Native_File_Chooser class by implementing its constructor as follows: \code Fl_Native_File_Chooser::Fl_Native_File_Chooser(int type) { platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(type); } \endcode */ class Fl_Native_File_Chooser_FLTK_Driver : public Fl_Native_File_Chooser_Driver { private: void errmsg(const char *msg); int type_fl_file(int val); int exist_dialog(); void parse_filter(); protected: int _btype; // kind-of browser to show() int _options; // general options int _nfilters; char *_filter; // user supplied filter char *_parsedfilt; // parsed filter int _filtvalue; // selected filter char *_preset_file; char *_prevvalue; // Returned filename char *_directory; char *_errmsg; // error message Fl_File_Chooser *_file_chooser; public: Fl_Native_File_Chooser_FLTK_Driver(int val); virtual ~Fl_Native_File_Chooser_FLTK_Driver(); void type(int t) FL_OVERRIDE; int type() const FL_OVERRIDE; void options(int o) FL_OVERRIDE; int options() const FL_OVERRIDE; int count() const FL_OVERRIDE; const char *filename() const FL_OVERRIDE; const char *filename(int i) const FL_OVERRIDE; void directory(const char *val) FL_OVERRIDE; const char *directory() const FL_OVERRIDE; void title(const char *t) FL_OVERRIDE; const char* title() const FL_OVERRIDE; const char *filter() const FL_OVERRIDE; void filter(const char *f) FL_OVERRIDE; int filters() const FL_OVERRIDE; void filter_value(int i) FL_OVERRIDE; int filter_value() const FL_OVERRIDE; void preset_file(const char*f) FL_OVERRIDE; const char* preset_file() const FL_OVERRIDE; const char *errmsg() const FL_OVERRIDE; int show() FL_OVERRIDE; }; /** \} \endcond */ #endif /*FL_NATIVE_FILE_CHOOSER_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Nice_Slider.H ================================================ // // "Nice" slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Nice_Slider widget . */ #ifndef Fl_Nice_Slider_H #define Fl_Nice_Slider_H #include "Fl_Slider.H" class FL_EXPORT Fl_Nice_Slider : public Fl_Slider { public: Fl_Nice_Slider(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Object.H ================================================ // // Old Fl_Object header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // This file is provided for back compatibility only. Please use Fl_Widget #ifndef Fl_Object #define Fl_Object Fl_Widget #endif #include "Fl_Widget.H" ================================================ FILE: Game Trainers/common/include/FL/Fl_Output.H ================================================ // // Output header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Output widget . */ #ifndef Fl_Output_H #define Fl_Output_H #include "Fl_Input.H" /** This widget displays a piece of text. When you set the value() , Fl_Output does a strcpy() to its own storage, which is useful for program-generated values. The user may select portions of the text using the mouse and paste the contents into other fields or programs. \image html text.png \image latex text.png "Fl_Output" width=8cm There is a single subclass, Fl_Multiline_Output, which allows you to display multiple lines of text. Fl_Multiline_Output does not provide scroll bars. If a more complete text editing widget is needed, use Fl_Text_Display instead. The text may contain any characters except \\0, and will correctly display anything, using ^X notation for unprintable control characters and \\nnn notation for unprintable characters with the high bit set. It assumes the font can draw any characters in the ISO-Latin1 character set. */ class FL_EXPORT Fl_Output : public Fl_Input { public: /** Creates a new Fl_Output widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Output(int X,int Y,int W,int H, const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Overlay_Window.H ================================================ // // Overlay window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Overlay_Window class . */ #ifndef Fl_Overlay_Window_H #define Fl_Overlay_Window_H #include "Fl_Double_Window.H" /** This window provides double buffering and also the ability to draw the "overlay" which is another picture placed on top of the main image. The overlay is designed to be a rapidly-changing but simple graphic such as a mouse selection box. Fl_Overlay_Window uses the overlay planes provided by your graphics hardware if they are available.

    If no hardware support is found the overlay is simulated by drawing directly into the on-screen copy of the double-buffered window, and "erased" by copying the backbuffer over it again. This means the overlay will blink if you change the image in the window. */ class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window { #ifndef FL_DOXYGEN friend class _Fl_Overlay; friend class Fl_Window_Driver; #endif public: /** You must subclass Fl_Overlay_Window and provide this method. It is just like a draw() method, except it draws the overlay. The overlay will have already been "cleared" when this is called. You can use any of the routines described in <FL/fl_draw.H>. */ virtual void draw_overlay() = 0; private: Fl_Window *overlay_; public: void show() FL_OVERRIDE; void hide() FL_OVERRIDE; void flush() FL_OVERRIDE; void resize(int,int,int,int) FL_OVERRIDE; ~Fl_Overlay_Window(); /** Returns non-zero if there's hardware overlay support */ int can_do_overlay(); void redraw_overlay(); protected: /** See Fl_Overlay_Window::Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0) */ Fl_Overlay_Window(int W, int H, const char *l=0); /** Creates a new Fl_Overlay_Window widget using the given position, size, and label (title) string. If the positions (x,y) are not given, then the window manager will choose them. */ Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0); public: /** Same as Fl_Window::show(int a, char **b) */ void show(int a, char **b) {Fl_Double_Window::show(a,b);} Fl_Overlay_Window *as_overlay_window() FL_OVERRIDE {return this; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_PDF_File_Surface.H ================================================ // // Declaration of class Fl_PDF_File_Surface for the Fast Light Tool Kit (FLTK). // // Copyright 2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef PDF_FILE_SURFACE_H #define PDF_FILE_SURFACE_H #include /** To send graphical output to a PDF file. Class Fl_PDF_File_Surface is used exactly as the Fl_Printer class except for its 2 member functions begin_job() and begin_document().

    Platform notes: - Windows: requires "Microsoft Print to PDF" available in Windows 10 and later. - Wayland/X11: requires the FLTK library was built with FLTK_USE_PANGO=1. - macOS: requires macOS 10.9 or later.

    If the running platform doesn't fulfill the requirement above, the program runs but doesn't output any PDF. */ class FL_EXPORT Fl_PDF_File_Surface : public Fl_Paged_Device { private: const char **out_filename_; Fl_Paged_Device *platform_surface_; static Fl_Paged_Device *new_platform_pdf_surface_(const char ***); public: /** \name These attributes are useful for the Wayland/X11 platform only. \{ */ static const char * format_dialog_title; static const char * format_dialog_page_size; static const char * format_dialog_orientation; static const char * format_dialog_default; /** \} */ Fl_PDF_File_Surface(); ~Fl_PDF_File_Surface(); /** Prepare to draw to a PDF document identified with a file chooser. A dialog opens to select the location and name of the output PDF document as well as its page format and orientation. \param defaultfilename Default name for the PDF document \param perr NULL or address of a string that receives a message in case of error. To be deleted[] after use. \return 0 for success, 1 when the user cancelled the operation, 2 when an error occurred. */ int begin_job(const char* defaultfilename, char **perr = NULL); /** Don't use for this class */ int begin_job(int, int *, int *, char **) FL_OVERRIDE {return 1;} /** Prepare to draw to a PDF document identified by its pathname. \param pathname Path name for the PDF document \param format The paper format for the PDF document \param layout The orientation for the PDF document \param perr NULL or address of a string that receives a message in case of error. To be deleted[] after use. \return 0 for success, 2 when an error occurred. */ int begin_document(const char* pathname, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT, char **perr = NULL); int printable_rect(int *w, int *h) FL_OVERRIDE { return platform_surface_->printable_rect(w,h); } void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE { platform_surface_->margins(left,top,right,bottom); } void origin(int x, int y) FL_OVERRIDE {platform_surface_->origin(x, y);} void origin(int *x, int *y) FL_OVERRIDE {platform_surface_->origin(x, y);} void scale(float s_x, float s_y = 0) FL_OVERRIDE {platform_surface_->scale(s_x, s_y);} void rotate(float angle) FL_OVERRIDE {platform_surface_->rotate(angle);} void translate(int x, int y) FL_OVERRIDE {platform_surface_->translate(x, y);} void untranslate() FL_OVERRIDE {platform_surface_->untranslate();}; int begin_page(void) FL_OVERRIDE {return platform_surface_->begin_page();} int end_page(void) FL_OVERRIDE {return platform_surface_->end_page();} void end_job(void) FL_OVERRIDE {return platform_surface_->end_job();} /** Returns the name of the PDF document */ inline const char *pdf_filename() { return *out_filename_; } void set_current() FL_OVERRIDE { if (platform_surface_) platform_surface_->set_current(); } bool is_current() FL_OVERRIDE { return surface() == platform_surface_; } }; #endif // PDF_FILE_SURFACE_H ================================================ FILE: Game Trainers/common/include/FL/Fl_PNG_Image.H ================================================ // // PNG image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_PNG_Image class . */ #ifndef Fl_PNG_Image_H #define Fl_PNG_Image_H # include "Fl_Image.H" /** The Fl_PNG_Image class supports loading, caching, and drawing of Portable Network Graphics (PNG) image files. The class loads color-mapped and full-color images and handles color- and alpha-based transparency. */ class FL_EXPORT Fl_PNG_Image : public Fl_RGB_Image { friend class Fl_ICO_Image; public: Fl_PNG_Image(const char* filename); Fl_PNG_Image (const char *name_png, const unsigned char *buffer, int datasize); private: Fl_PNG_Image(const char *filename, int offset); // used by Fl_ICO_Image void load_png_(const char *name_png, int offset, const unsigned char *buffer_png, int datasize); }; // Support functions to write PNG image files (since 1.4.0) FL_EXPORT int fl_write_png(const char *filename, Fl_RGB_Image *img); FL_EXPORT int fl_write_png(const char *filename, const char *pixels, int w, int h, int d=3, int ld=0); FL_EXPORT int fl_write_png(const char *filename, const unsigned char *pixels, int w, int h, int d=3, int ld=0); #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_PNM_Image.H ================================================ // // PNM image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_PNM_Image class . */ #ifndef Fl_PNM_Image_H #define Fl_PNM_Image_H # include "Fl_Image.H" /** The Fl_PNM_Image class supports loading, caching, and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image files. The class loads bitmap, grayscale, and full-color images in both ASCII and binary formats. */ class FL_EXPORT Fl_PNM_Image : public Fl_RGB_Image { public: Fl_PNM_Image(const char* filename); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Pack.H ================================================ // // Pack header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Pack widget . */ #ifndef Fl_Pack_H #define Fl_Pack_H #include /** This widget was designed to add the functionality of compressing and aligning widgets. If type() is Fl_Pack::HORIZONTAL all the children are resized to the height of the Fl_Pack, and are moved next to each other horizontally. If type() is not Fl_Pack::HORIZONTAL then the children are resized to the width and are stacked below each other. Then the Fl_Pack resizes itself to surround the child widgets. You may want to put the Fl_Pack inside an Fl_Scroll. The \p 'resizable()' for Fl_Pack is set to NULL by default. Its behavior is slightly different than in a normal Fl_Group widget: only if the resizable() widget is the last widget in the group it is extended to take the full available width or height, respectively, of the Fl_Pack group. \note You can nest Fl_Pack widgets or put them inside Fl_Scroll widgets or inside other group widgets but their behavior can sometimes be "surprising". This is partly due to the fact that Fl_Pack widgets resize themselves during their draw() operation, trying to react on their child widgets resizing themselves during \b their draw() operations which can be confusing. If you want to achieve special resize behavior of nested group widgets it can sometimes be easier to derive your own specialized group widget than to try to make nested Fl_Pack widgets behave as expected. \see Fl_Group::resizable() */ class FL_EXPORT Fl_Pack : public Fl_Group { int spacing_; public: enum { // values for type(int) VERTICAL = 0, HORIZONTAL = 1 }; protected: void draw() FL_OVERRIDE; public: Fl_Pack(int X, int Y, int W, int H, const char *L = 0); /** Gets the number of extra pixels of blank space that are added between the children. */ int spacing() const {return spacing_;} /** Sets the number of extra pixels of blank space that are added between the children. */ void spacing(int i) {spacing_ = i;} /** Returns non-zero if Fl_Pack alignment is horizontal. \returns non-zero if Fl_Pack alignment is horizontal (Fl_Pack::HORIZONTAL) \note Currently the return value is the same as Fl_Group::type(), but this may change in the future. Do not set any other values than the following with Fl_Pack::type(): - Fl_Pack::VERTICAL (Default) - Fl_Pack::HORIZONTAL See class Fl_Pack documentation for details. */ uchar horizontal() const {return type();} void resize(int X, int Y, int W, int H) FL_OVERRIDE; /** Deletes all child widgets with Fl_Group::clear(). And sets to NULL the resizable() widget. */ void clear() { Fl_Group::clear(); resizable(NULL); } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Paged_Device.H ================================================ // // Printing support for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Paged_Device.H \brief declaration of class Fl_Paged_Device. */ #ifndef Fl_Paged_Device_H #define Fl_Paged_Device_H #include /** \brief Number of elements in enum Page_Format */ #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */ /** \brief Represents page-structured drawing surfaces. This class has no public constructor: don't instantiate it; use Fl_Printer or Fl_PostScript_File_Device instead. */ class FL_EXPORT Fl_Paged_Device : public Fl_Widget_Surface { protected: /** \brief The constructor */ Fl_Paged_Device() : Fl_Widget_Surface(NULL) {} public: /** Possible page formats. All paper formats with pre-defined width and height. The Fl_Paged_Device::page_formats array gives these widths and heights. */ enum Page_Format { A0 = 0, /**< A0 format */ A1, /**< A1 format */ A2, /**< A2 format */ A3, /**< A3 format */ A4, /**< A4 format */ A5, /**< A5 format */ A6, /**< A6 format */ A7, /**< A7 format */ A8, /**< A8 format */ A9, /**< A9 format */ B0, /**< B0 format */ B1, /**< B1 format */ B2, /**< B2 format */ B3, /**< B3 format */ B4, /**< B4 format */ B5, /**< B5 format */ B6, /**< B6 format */ B7, /**< B7 format */ B8, /**< B8 format */ B9, /**< B9 format */ B10, /**< B10 format */ C5E, DLE, EXECUTIVE, /**< Executive format */ FOLIO, /**< Folio format */ LEDGER, /**< Ledger format */ LEGAL, /**< Legal format */ LETTER, /**< Letter format */ TABLOID, /**< Tabloid format */ ENVELOPE, MEDIA = 0x1000 }; /** \brief Possible page layouts. */ enum Page_Layout { PORTRAIT = 0, /**< Portrait orientation */ LANDSCAPE = 0x100, /**< Landscape orientation */ REVERSED = 0x200, /**< Reversed orientation */ ORIENTATION = 0x300 /**< orientation */ }; /** \brief width, height and name of a page format */ typedef struct { /** \brief width in points */ int width; /** \brief height in points */ int height; /** \brief format name */ const char *name; } page_format; /** \brief width, height and name of all elements of the enum \ref Page_Format. */ static const page_format page_formats[NO_PAGE_FORMATS]; /** \brief The destructor */ virtual ~Fl_Paged_Device() {} virtual int begin_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL); /** Synonym of begin_job(int pagecount, int *frompage, int *topage, char **perr_message). For API compatibility with FLTK 1.3.x */ int start_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL) { return begin_job(pagecount, frompage, topage, perr_message); } virtual int begin_page(void); /** Synonym of begin_page(). For API compatibility with FLTK 1.3.x */ int start_page() {return begin_page();} virtual void margins(int *left, int *top, int *right, int *bottom); virtual void scale(float scale_x, float scale_y = 0.); virtual void rotate(float angle); /** Synonym of draw(Fl_Widget*, int, int) */ void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0) {draw(widget, delta_x, delta_y);} /** Synonym of draw_decorated_window(Fl_Window*, int, int) */ void print_window(Fl_Window *win, int x_off = 0, int y_off = 0) { draw_decorated_window(win, x_off, y_off); } virtual int end_page (void); virtual void end_job (void); }; #endif // Fl_Paged_Device_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Pixmap.H ================================================ // // Pixmap header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Pixmap widget . */ #ifndef Fl_Pixmap_H #define Fl_Pixmap_H # include "Fl_Image.H" class Fl_Widget; struct Fl_Menu_Item; // Older C++ compilers don't support the explicit keyword... :( # if defined(__sgi) && !defined(_COMPILER_VERSION) # define explicit # endif // __sgi && !_COMPILER_VERSION /** The Fl_Pixmap class supports caching and drawing of colormap (pixmap) images, including transparency. */ class FL_EXPORT Fl_Pixmap : public Fl_Image { friend class Fl_Graphics_Driver; void copy_data(); void delete_data(); void set_data(const char * const *p); protected: void measure(); public: int alloc_data; // Non-zero if data was allocated private: // for internal use fl_uintptr_t id_; fl_uintptr_t mask_; int cache_w_, cache_h_; // size of pixmap when cached public: /** The constructors create a new pixmap from the specified XPM data. */ explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} /** The constructors create a new pixmap from the specified XPM data. */ explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} /** The constructors create a new pixmap from the specified XPM data. */ explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} /** The constructors create a new pixmap from the specified XPM data. */ explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} virtual ~Fl_Pixmap(); Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Image::copy(); } void color_average(Fl_Color c, float i) FL_OVERRIDE; void desaturate() FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx=0, int cy=0) FL_OVERRIDE; void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; int cache_w() {return cache_w_;} int cache_h() {return cache_h_;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Plugin.H ================================================ // // A Plugin system for FLTK, implemented in Fl_Preferences.cxx. // // Copyright 2002-2023 by Matthias Melcher. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Plugin class . */ #ifndef Fl_Plugin_H # define Fl_Plugin_H # include "Fl_Preferences.H" /** \brief Fl_Plugin allows link-time and run-time integration of binary modules. Fl_Plugin and Fl_Plugin_Manager provide a small and simple solution for linking C++ classes at run-time, or optionally linking modules at compile time without the need to change the main application. Fl_Plugin_Manager uses static initialization to create the plugin interface early during startup. Plugins are stored in a temporary database, organized in classes. Plugins should derive a new class from Fl_Plugin as a base: \code class My_Plugin : public Fl_Plugin { public: My_Plugin() : Fl_Plugin("effects", "blur") { } void do_something(...); }; My_Plugin blur_plugin(); \endcode Plugins can be put into modules and either linked before distribution, or loaded from dynamically linkable files. An Fl_Plugin_Manager is used to list and access all currently loaded plugins. \code Fl_Plugin_Manager mgr("effects"); int i, n = mgr.plugins(); for (i=0; ido_something(); } \endcode */ class FL_EXPORT Fl_Plugin { Fl_Preferences::ID id; public: Fl_Plugin(const char *klass, const char *name); virtual ~Fl_Plugin(); }; /** \brief Fl_Plugin_Manager manages link-time and run-time plugin binaries. \see Fl_Plugin */ class FL_EXPORT Fl_Plugin_Manager : public Fl_Preferences { public: Fl_Plugin_Manager(const char *klass); ~Fl_Plugin_Manager(); /** \brief Return the number of plugins in the klass. */ int plugins() { return groups(); } Fl_Plugin *plugin(int index); Fl_Plugin *plugin(const char *name); Fl_Preferences::ID addPlugin(const char *name, Fl_Plugin *plugin); static void removePlugin(Fl_Preferences::ID id); static int load(const char *filename); static int loadAll(const char *dirpath, const char *pattern=0); }; #endif // !Fl_Preferences_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Positioner.H ================================================ // // Positioner header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Positioner widget . */ #ifndef Fl_Positioner_H #define Fl_Positioner_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif /** This class is provided for Forms compatibility. It provides 2D input. It would be useful if this could be put atop another widget so that the crosshairs are on top, but this is not implemented. The color of the crosshairs is selection_color(). \image html positioner.png \image latex positioner.png "Fl_Positioner" width=4cm */ class FL_EXPORT Fl_Positioner : public Fl_Widget { double xmin, ymin; double xmax, ymax; double xvalue_, yvalue_; double xstep_, ystep_; protected: // these allow subclasses to put the dial in a smaller area: void draw(int, int, int, int); int handle(int, int, int, int, int); void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; /** Creates a new Fl_Positioner widget using the given position, size, and label string. The default boxtype is FL_NO_BOX. */ Fl_Positioner(int x,int y,int w,int h, const char *l=0); /** Gets the X axis coordinate.*/ double xvalue() const {return xvalue_;} /** Gets the Y axis coordinate.*/ double yvalue() const {return yvalue_;} int xvalue(double); int yvalue(double); int value(double,double); void xbounds(double, double); /** Gets the X axis minimum */ double xminimum() const {return xmin;} /** Same as xbounds(a, xmaximum()) */ void xminimum(double a) {xbounds(a,xmax);} /** Gets the X axis maximum */ double xmaximum() const {return xmax;} /** Same as xbounds(xminimum(), a) */ void xmaximum(double a) {xbounds(xmin,a);} void ybounds(double, double); /** Gets the Y axis minimum */ double yminimum() const {return ymin;} /** Same as ybounds(a, ymaximum()) */ void yminimum(double a) {ybounds(a, ymax);} /** Gets the Y axis maximum */ double ymaximum() const {return ymax;} /** Same as ybounds(ymininimum(), a) */ void ymaximum(double a) {ybounds(ymin, a);} /** Sets the stepping value for the X axis.*/ void xstep(double a) {xstep_ = a;} /** Sets the stepping value for the Y axis.*/ void ystep(double a) {ystep_ = a;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_PostScript.H ================================================ // // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_PostScript.H \brief declaration of classes Fl_PostScript_File_Device and Fl_EPS_File_Surface. */ #ifndef Fl_PostScript_H #define Fl_PostScript_H #include #include #include /** Signature of functions FLTK may use to close FILE variables after PostScript/EPS output. A non-null return value indicates output error. \see Fl_PostScript_File_Device::close_command() and Fl_EPS_File_Surface::Fl_EPS_File_Surface(). */ extern "C" { typedef int (*Fl_PostScript_Close_Command)(FILE *); } class Fl_PostScript_Graphics_Driver; /** To send graphical output to a PostScript file. This class is used exactly as the Fl_Printer class except for the begin_job() call, two variants of which are usable and allow to specify what page format and layout are desired.
    Processing of text: Text uses vectorial fonts under the X11 + Pango and the Wayland platforms. With other platforms, only text restricted to the Latin alphabet (and a few other characters listed in the table below) and to FLTK standard fonts is vectorized. All other unicode characters or all other fonts (FL_FREE_FONT and above) are output as a bitmap. FLTK standard fonts are output using the corresponding PostScript standard fonts. The latin alphabet means all unicode characters between U+0020 and U+017F, or, in other words, the ASCII, Latin-1 Supplement and Latin Extended-A charts. \htmlonly
    Extra characters supported by standard PostScript fonts
    CharCodepointName CharCodepointName CharCodepointName
    ƒU+0192florinU+201AquotesinglbaseU+2122trademark
    ˆU+02C6circumflexU+201CquotedblleftU+2202partialdiff
    ˇU+02C7caronU+201DquotedblrightΔU+2206Delta
    ˘U+02D8breveU+201EquotedblbaseU+2211summation
    ˙U+02D9dotaccentU+2020daggerU+221Aradical
    ˚U+02DAringU+2021daggerdblU+221Einfinity
    ˛U+02DBogonekU+2022bulletU+2260notequal
    ˜U+02DCtildeU+2026ellipsisU+2264lessequal
    ˝U+02DDhungarumlautU+2030perthousandU+2265greaterequal
    U+2013endashU+2039guilsinglleftU+25CAlozenge
    U+2014emdashU+203AguilsinglrightU+FB01fi
    U+2018quoteleft/U+2044fractionU+FB02fl
    U+2019quoterightU+20ACEuroU+F8FFapple (macOS only)
    \endhtmlonly \image latex extraPSchars.png "Extra characters supported by standard PostScript fonts" width=16cm Processing of transparent Fl_RGB_Image objects: Under the X11 + Pango and the Wayland platforms, these objects are output with their exact transparency. With other platforms, these objects are drawn blended to white color. Class Fl_EPS_File_Surface 's constructor allows to set another background color for blending. */ class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device { private: // memorize the display's current font to restore it when the object ceases being current Fl_Font display_font_; Fl_Fontsize display_size_; protected: /** \brief Returns the PostScript driver of this drawing surface. */ inline Fl_PostScript_Graphics_Driver *driver() { return (Fl_PostScript_Graphics_Driver*)Fl_Surface_Device::driver(); } public: /** The constructor. */ Fl_PostScript_File_Device(); /** The destructor. */ ~Fl_PostScript_File_Device(); /** Don't use with this class. */ int begin_job(int pagecount, int* from, int* to, char **perr_message) FL_OVERRIDE; /** Begins the session where all graphics requests will go to a local PostScript file. Opens a file dialog to select an output PostScript file. This member function makes end_job() close the resulting PostScript file and display an alert message with fl_alert() in case of any output error. @param pagecount The total number of pages to be created. Use 0 if this number is unknown when this function is called. @param format Desired page format. @param layout Desired page layout. @return 0 if OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file. */ int begin_job(int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT); /** Synonym of begin_job(). For API compatibility with FLTK 1.3.x */ int start_job(int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT) { return begin_job(pagecount, format, layout); } /** Begins the session where all graphics requests will go to FILE pointer. This member function prevents end_job() from closing \p ps_output, so the user can check with \p ferror(ps_output) for output errors. @param ps_output A writable FILE pointer that will receive PostScript output and that should not be closed until after end_job() has been called. @param pagecount The total number of pages to be created. Use 0 if this number is unknown when this function is called. @param format Desired page format. @param layout Desired page layout. @return always 0. */ int begin_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT); /** Synonym of begin_job(). For API compatibility with FLTK 1.3.x */ int start_job(FILE *ps_output, int pagecount = 0, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT) { return begin_job(ps_output, pagecount, format, layout); } int begin_page (void) FL_OVERRIDE; int printable_rect(int *w, int *h) FL_OVERRIDE; void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE; void origin(int *x, int *y) FL_OVERRIDE; void origin(int x, int y) FL_OVERRIDE; void scale (float scale_x, float scale_y = 0.) FL_OVERRIDE; void rotate(float angle) FL_OVERRIDE; void translate(int x, int y) FL_OVERRIDE; void untranslate(void) FL_OVERRIDE; int end_page (void) FL_OVERRIDE; /** Completes all PostScript output. This also closes with \p fclose() the underlying file() unless close_command() was used to set another function. */ void end_job(void) FL_OVERRIDE; /** Label of the PostScript file chooser window */ static const char *file_chooser_title; /** Returns the underlying FILE* receiving all PostScript data */ FILE *file(); /** Sets the function end_job() calls to close the file() */ void close_command(Fl_PostScript_Close_Command cmd); void set_current() FL_OVERRIDE; void end_current() FL_OVERRIDE; }; /** Encapsulated PostScript drawing surface. This drawing surface allows to store any FLTK graphics in vectorial form in an "Encapsulated PostScript" file. \n Usage example: \code Fl_Window *win = ...// Window to draw to an .eps file int ww = win->decorated_w(); int wh = win->decorated_h(); FILE *eps = fl_fopen("/path/to/mywindow.eps", "w"); if (eps) { Fl_EPS_File_Surface *surface = new Fl_EPS_File_Surface(ww, wh, eps, win->color()); Fl_Surface_Device::push_current(surface); surface->draw_decorated_window(win); Fl_Surface_Device::pop_current(); delete surface; // the .eps file is not complete until the destructor was run } \endcode */ class FL_EXPORT Fl_EPS_File_Surface : public Fl_Widget_Surface { protected: /** Returns the PostScript driver of this drawing surface. */ inline Fl_PostScript_Graphics_Driver *driver() { return (Fl_PostScript_Graphics_Driver*)Fl_Surface_Device::driver(); } public: /** Constructor. \param width,height Width and height of the EPS drawing area \param eps_output A writable FILE pointer where the Encapsulated PostScript data will be sent \param background Color expected to cover the background of the EPS drawing area. This parameter affects only the drawing of transparent Fl_RGB_Image objects: transparent areas of RGB images are blended with the \p background color. Under the X11 + pango platform, transparent RGB images are correctly blended to their background, thus this parameter has no effect. \param closef If not NULL, the destructor or close() will call \p closef(eps_output) after all EPS data has been sent. If NULL, \p fclose(eps_output) is called instead. This allows to close the FILE pointer by, e.g., \p pclose, or, using a function such as \p "int keep_open(FILE*){return 0;}", to keep it open after completion of all output to \p eps_output. Function \p closef should return non zero to indicate an error. */ Fl_EPS_File_Surface(int width, int height, FILE *eps_output, Fl_Color background = FL_WHITE, Fl_PostScript_Close_Command closef = NULL); /** Destructor. By default, the destructor closes with function \p fclose() the underlying FILE. See the constructor for how to close it differently or to keep it open. Use close() before object destruction to receive the status code of output operations. If close() is not used and if EPS output results in error, the destructor displays an alert message with fl_alert(). */ ~Fl_EPS_File_Surface(); int printable_rect(int *w, int *h) FL_OVERRIDE; /** Returns the underlying FILE pointer */ FILE *file(); void origin(int x, int y) FL_OVERRIDE; void origin(int *px, int *py) FL_OVERRIDE; void translate(int x, int y) FL_OVERRIDE; void untranslate() FL_OVERRIDE; /** Completes all EPS output. The only operation possible with the Fl_EPS_File_Surface object after calling close() is its destruction. \return The status code of output operations to the FILE object. 0 indicates success. */ int close(); }; #endif // Fl_PostScript_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Preferences.H ================================================ // // Preferences implementation for the Fast Light Tool Kit (FLTK). // // Copyright 2002-2023 by Matthias Melcher. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Preferences class . */ #ifndef Fl_Preferences_H # define Fl_Preferences_H # include # include "Fl_Export.H" # include "fl_attr.h" //class Fl_String; #if (FLTK_USE_STD) #include #endif /** \brief Fl_Preferences store user settings between application starts. FLTK Preferences are similar to the Registry on Windows and Preferences on MacOS, providing a simple method to store customizable user settings between application launches. A typical use is storing the last window position or a history of previously used documents. Preferences are organized in a hierarchy of groups. Every group can contain more groups and any number of key/value pairs. Keys can be text strings containing ASCII letters, digits, periods, and underscores. Forward slashes in a key name are treated as subgroups, i.e. the key 'window/width' would actually refer to the key 'width' inside the group 'window'. Keys have a unique name within their group. A value can be any string including control characters 0x00 to 0x1f, 0x7f, and UTF-8 octets. Several methods allow setting and getting numerical values and binary data. Preferences files are the same across platforms. User comments in preference files are preserved. Filenames are unique for each application by using a vendor/application naming scheme. The developer app must provide default values for all entries to ensure proper operation should preferences be corrupted or not yet exist. \note The format of preferences files is not part of the FLTK specification and intentionally undocumented. The only valid way to read or write prefs files is via the API from your app. The fact that the current implementation looks like human-readable text is purely coincidental and may change at any time. Preferences files are not meant to be created or edited "by hand." FLTK preferences are not meant to replace a fully featured database. No merging of data takes place. If several instances of an app access the same database at the same time, only the most recent changes will persist. Preferences should not be used to store document data. The .prefs file should be kept small for performance reasons. One application can have multiple preferences files. Extensive binary data however should be stored in separate files: see \a Fl_Preferences::get_userdata_path() . Fl_Preferences are not thread-safe. They can temporarily change the locale on some platforms during read and write access, which also changes it temporarily in other threads of the same app. Typically a preferences database is read at startup, and then reopened and written at app shutdown: ``` int appWindowWidth, appWindowHeight; void launch() { Fl_Preferences app(Fl_Preferences::USER_L, "matthiasm.com", "hello"); // 'app' constructor will be called, reading data from .prefs file Fl_Preferences window(app, "window"); window.get("width", appWindowWidth, 800); window.get("height", appWindowHeight, 600); // 'app' destructor will be called. This will write data to the // .prefs file if any preferences were changed or added } void quit() { Fl_Preferences app(Fl_Preferences::USER_L, "matthiasm.com", "hello"); Fl_Preferences window(app, "window"); window.set("width", appWindowWidth); window.set("height", appWindowHeight); } ``` \see Fl_Preferences::Fl_Preferences(Root root, const char *vendor, const char *application) \see As a special case, Fl_Preferences can be memory mapped and not be associated with a file on disk. See Fl_Preferences::Fl_Preferences(Fl_Preferences *parent, const char *group) and Fl_Preferences::MEMORY for more details on memory mapped preferences. \note Starting with FLTK 1.3, preferences databases are expected to be in UTF-8 encoding. Previous databases were stored in the current character set or code page which renders them incompatible for text entries using international characters. \note Starting with FLTK 1.4, searching a valid path to store the preference files has changed slightly. Please see Fl_Preferences::Fl_Preferences(Root, const char*, const char*) for details. \note Starting with FLTK 1.4, preference files should be created with `SYSTEM_L` or `USER_L` to be interchangeable between computers with differing locale settings. The legacy modes, `LOCAL` and `SYSTEM`, will read and write floating point values using the decimal point of the current locale. As a result, a fp-value would be written '3,1415' on a German machine, and would be read back as '3.0' on a US machine because the comma would not be recognized as an alternative decimal point. */ class FL_EXPORT Fl_Preferences { public: /** Define the scope of the preferences. */ enum Root { UNKNOWN_ROOT_TYPE = -1, ///< Returned if storage could not be determined. SYSTEM = 0, ///< Preferences are used system-wide. Deprecated, see SYSTEM_L USER, ///< Preferences apply only to the current user. Deprecated, see USER_L MEMORY, ///< Returned if querying memory mapped preferences ROOT_MASK = 0x00FF, ///< Mask for the values above CORE = 0x0100, ///< OR'd by FLTK to read and write core library preferences and options C_LOCALE = 0x1000, ///< This flag should always be set to ensure that floating point values ///< are written and read correctly independently of the current locale CLEAR = 0x2000, ///< Don't read a possibly existing database. Instead, start with an empty set of preferences. SYSTEM_L = SYSTEM | C_LOCALE, ///< Preferences are used system-wide, locale independent USER_L = USER | C_LOCALE, ///< Preferences apply only to the current user, locale independent CORE_SYSTEM_L = CORE | SYSTEM_L, ///< Same as CORE | SYSTEM | C_LOCALE CORE_USER_L = CORE | USER_L, ///< Same as CORE | USER | C_LOCALE CORE_SYSTEM = CORE | SYSTEM, ///< Deprecated, same as CORE | SYSTEM. Use CORE_SYSTEM_L instead. CORE_USER = CORE | USER ///< Deprecated, same as CORE | USER. Use CORE_USER_L instead. }; /** Every Fl_Preferences-Group has a unique ID. ID's can be retrieved from an Fl_Preferences-Group and can then be used to create more Fl_Preference references to the same data set, as long as the database remains open. */ typedef void *ID; static const char *new_UUID(); /** Set this if no call to Fl_Preferences shall access the file system. @see Fl_Preferences::file_access(unsigned int) @see Fl_Preferences::file_access() */ static const unsigned int NONE = 0x0000; /** Set this if it is OK for applications to read user preference files. */ static const unsigned int USER_READ_OK = 0x0001; /** Set this if it is OK for applications to create and write user preference files. */ static const unsigned int USER_WRITE_OK = 0x0002; /** Set this if it is OK for applications to read, create, and write user preference files. */ static const unsigned int USER_OK = USER_READ_OK | USER_WRITE_OK; /** Set this if it is OK for applications to read system wide preference files. */ static const unsigned int SYSTEM_READ_OK = 0x0004; /** Set this if it is OK for applications to create and write system wide preference files. */ static const unsigned int SYSTEM_WRITE_OK = 0x0008; /** Set this if it is OK for applications to read, create, and write system wide preference files. */ static const unsigned int SYSTEM_OK = SYSTEM_READ_OK | SYSTEM_WRITE_OK; /** Set this if it is OK for applications to read, create, and write any kind of preference files. */ static const unsigned int APP_OK = SYSTEM_OK | USER_OK; /** Set this if it is OK for FLTK to read preference files. USER_READ_OK and/or SYSTEM_READ_OK must also be set. */ static const unsigned int CORE_READ_OK = 0x0010; /** Set this if it is OK for FLTK to create or write preference files. USER_WRITE_OK and/or SYSTEM_WRITE_OK must also be set. */ static const unsigned int CORE_WRITE_OK = 0x0020; /** Set this if it is OK for FLTK to read, create, or write preference files. */ static const unsigned int CORE_OK = CORE_READ_OK | CORE_WRITE_OK; /** Set this to allow FLTK and applications to read preference files. */ static const unsigned int ALL_READ_OK = USER_READ_OK | SYSTEM_READ_OK | CORE_READ_OK; /** Set this to allow FLTK and applications to create and write preference files. */ static const unsigned int ALL_WRITE_OK = USER_WRITE_OK | SYSTEM_WRITE_OK | CORE_WRITE_OK; /** Set this to give FLTK and applications permission to read, write, and create preference files. */ static const unsigned int ALL = ALL_READ_OK | ALL_WRITE_OK; static void file_access(unsigned int flags); static unsigned int file_access(); static Root filename( char *buffer, size_t buffer_size, Root root, const char *vendor, const char *application ); Fl_Preferences( Root root, const char *vendor, const char *application ); Fl_Preferences( const char *path, const char *vendor, const char *application, Root flags ); Fl_Preferences( Fl_Preferences &parent, const char *group ); Fl_Preferences( Fl_Preferences *parent, const char *group ); Fl_Preferences( Fl_Preferences &parent, int groupIndex ); Fl_Preferences( Fl_Preferences *parent, int groupIndex ); Fl_Preferences(const Fl_Preferences&); Fl_Preferences( ID id ); virtual ~Fl_Preferences(); FL_DEPRECATED("since 1.4.0 - use Fl_Preferences(path, vendor, application, flags) instead", Fl_Preferences( const char *path, const char *vendor, const char *application ) ); Root filename( char *buffer, size_t buffer_size); /** Return an ID that can later be reused to open more references to this dataset. */ ID id() { return (ID)node; } /** Remove the group with this ID from a database. */ static char remove(ID id_) { return ((Node*)id_)->remove(); } /** Return the name of this entry. */ const char *name() { return node->name(); } /** Return the full path to this entry. */ const char *path() { return node->path(); } int groups(); const char *group( int num_group ); char group_exists( const char *key ); char delete_group( const char *group ); char delete_all_groups(); int entries(); const char *entry( int index ); char entry_exists( const char *key ); char delete_entry( const char *entry ); char delete_all_entries(); char clear(); char set( const char *entry, int value ); char set( const char *entry, float value ); char set( const char *entry, float value, int precision ); char set( const char *entry, double value ); char set( const char *entry, double value, int precision ); char set( const char *entry, const char *value ); char set( const char *entry, const void *value, int size ); char get( const char *entry, int &value, int defaultValue ); char get( const char *entry, float &value, float defaultValue ); char get( const char *entry, double &value, double defaultValue ); char get( const char *entry, char *&value, const char *defaultValue ); char get( const char *entry, char *value, const char *defaultValue, int maxSize ); char get( const char *entry, void *&value, const void *defaultValue, int defaultSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int *size ); // char set( const char *entry, const Fl_String &value ); // char get( const char *entry, Fl_String &value, const Fl_String &defaultValue ); #if (FLTK_USE_STD) char set( const char *entry, const std::string &value ); char get( const char *entry, std::string &value, const std::string &defaultValue ); #endif int size( const char *entry ); char get_userdata_path( char *path, int pathlen ); int flush(); int dirty(); /** \cond PRIVATE */ static const char *newUUID() { return new_UUID(); } char groupExists( const char *key ) { return group_exists(key); } char deleteGroup( const char *group ) { return delete_group(group); } char deleteAllGroups() { return delete_all_groups(); } char entryExists( const char *key ) { return entry_exists(key); } char deleteEntry( const char *entry ) { return delete_entry(entry); } char deleteAllEntries() { return delete_all_entries(); } char getUserdataPath( char *path, int pathlen ) { return get_userdata_path(path, pathlen); } /** \endcond */ /** 'Name' provides a simple method to create numerical or more complex procedural names for entries and groups on the fly. Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);. See test/preferences.cxx as a sample for writing arrays into preferences. 'Name' is actually implemented as a class inside Fl_Preferences. It casts into const char* and gets automatically destroyed after the enclosing call ends. */ class FL_EXPORT Name { char *data_; public: Name( unsigned int n ); Name( const char *format, ... ); /** Return the Name as a "C" string. \internal */ operator const char *() { return data_; } ~Name(); }; /** \internal An entry associates a preference name to its corresponding value */ struct Entry { char *name, *value; }; private: Fl_Preferences() : node(0), rootNode(0) { } Fl_Preferences &operator=(const Fl_Preferences&); static char nameBuffer[128]; static char uuidBuffer[40]; static Fl_Preferences *runtimePrefs; static unsigned int fileAccess_; public: // older Sun compilers need this (public definition of the following classes) class RootNode; class FL_EXPORT Node { // a node contains a list to all its entries // and all means to manage the tree structure Node *first_child_, *next_; union { // these two are mutually exclusive Node *parent_; // top_ bit clear RootNode *root_node_; // top_ bit set }; char *path_; Entry *entry_; int nEntry_, NEntry_; unsigned char dirty_:1; unsigned char top_:1; unsigned char indexed_:1; // indexing routines Node **index_; int nIndex_, NIndex_; void createIndex(); void updateIndex(); void deleteIndex(); public: static int lastEntrySet; public: Node( const char *path ); ~Node(); // node methods int write( FILE *f ); const char *name(); const char *path() { return path_; } Node *find( const char *path ); Node *search( const char *path, int offset=0 ); Node *childNode( int ix ); Node *addChild( const char *path ); void setParent( Node *parent ); Node *parent() { return top_?0L:parent_; } void setRoot(RootNode *r) { root_node_ = r; top_ = 1; } RootNode *findRoot(); char remove(); char dirty(); void clearDirtyFlags(); void deleteAllChildren(); // entry methods int nChildren(); const char *child( int ix ); void set( const char *name, const char *value ); void set( const char *line ); void add( const char *line ); const char *get( const char *name ); int getEntry( const char *name ); char deleteEntry( const char *name ); void deleteAllEntries(); int nEntry() { return nEntry_; } Entry &entry(int i) { return entry_[i]; } }; friend class Node; class FL_EXPORT RootNode { // the root node manages file paths and basic reading and writing Fl_Preferences *prefs_; char *filename_; char *vendor_, *application_; Root root_type_; public: RootNode( Fl_Preferences *, Root root, const char *vendor, const char *application ); RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application, Root flags ); RootNode( Fl_Preferences * ); ~RootNode(); int read(); int write(); char getPath( char *path, int pathlen ); char *filename() { return filename_; } Root root() { return root_type_; } }; friend class RootNode; protected: Node *node; RootNode *rootNode; }; #endif // !Fl_Preferences_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Printer.H ================================================ // // Printing support for the Fast Light Tool Kit (FLTK). // // Copyright 2010-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Printer.H \brief declaration of class Fl_Printer. */ #ifndef Fl_Printer_H #define Fl_Printer_H #include /** \brief OS-independent print support. Fl_Printer allows to use all drawing, color, text, image, and clip FLTK functions, and to have them operate on printed page(s). There are two main, non exclusive, ways to use it.

    • Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears on screen, with optional translation, scaling and rotation. This is done by calling print_widget(), print_window() or print_window_part().
    • Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to compose a page appropriately shaped for printing.
    In both cases, begin by begin_job(), begin_page(), printable_rect() and origin() calls and finish by end_page() and end_job() calls.

    Example of use: print a widget centered in a page \code #include #include int width, height; Fl_Widget *widget = ... // a widget we want printed Fl_Printer *printer = new Fl_Printer(); if (printer->begin_job(1) == 0) { printer->begin_page(); printer->printable_rect(&width, &height); fl_color(FL_BLACK); fl_line_style(FL_SOLID, 2); fl_rect(0, 0, width, height); fl_font(FL_COURIER, 12); time_t now; time(&now); fl_draw(ctime(&now), 0, fl_height()); printer->origin(width/2, height/2); printer->print_widget(widget, -widget->w()/2, -widget->h()/2); printer->end_page(); printer->end_job(); } delete printer; \endcode

    Recommended method to refresh GUI while printing : \code printer->begin_job(0); …… Fl_Surface_Device::push_current(Fl_Display_Device::display_device()); Fl::check(); // or any operation that draws to display Fl_Surface_Device::pop_current(); …… printer->end_job(); \endcode Platform specifics

    • X11 and Wayland platforms:
      • FLTK expresses all graphics data using (Level 2) PostScript and sends that to the selected printer. See class Fl_PostScript_File_Device for a description of how text and transparent images appear in print.
      • If the GTK library is available at run-time, class Fl_Printer runs GTK's printer dialog which allows to set printer, paper size and orientation.
      • If the GTK library is not available, or if Fl::option(Fl::OPTION_PRINTER_USES_GTK) has been turned off, class Fl_Printer runs FLTK's print dialog.
        • Unless it has been previously changed, the default paper size is A4. To change that, press the "Properties" button of the "Print" dialog window opened by an Fl_Printer::begin_job() call. This opens a "Printer Properties" window where it's possible to select the adequate paper size. Finally press the "Save" button therein to assign the chosen paper size to the chosen printer for this and all further print operations.
        • Use the static public attributes of this class to set the print dialog to other languages than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with: \code Fl_Printer::dialog_printer = "Imprimante:"; \endcode before creation of the Fl_Printer object.
        • Use Fl_PostScript_File_Device::file_chooser_title to customize the title of the file chooser dialog that opens when using the "Print To File" option of the print dialog.
    • Windows platform: Transparent Fl_RGB_Image 's don't print with exact transparency on most printers (a workaround is to use print_window_part() ). Fl_RGB_Image 's don't rotate() well.
    • Mac OS X platform: all graphics requests print as on display and accept rotation and scaling.
    */ class FL_EXPORT Fl_Printer : public Fl_Paged_Device { private: Fl_Paged_Device *printer; /** Each platform implements this function its own way */ static Fl_Paged_Device* newPrinterDriver(void); public: /** The constructor */ Fl_Printer(void); int begin_job(int pagecount = 0, int *frompage = NULL, int *topage = NULL, char **perr_message = NULL) FL_OVERRIDE; int begin_page(void) FL_OVERRIDE; int printable_rect(int *w, int *h) FL_OVERRIDE; void margins(int *left, int *top, int *right, int *bottom) FL_OVERRIDE; void origin(int *x, int *y) FL_OVERRIDE; void origin(int x, int y) FL_OVERRIDE; void scale(float scale_x, float scale_y = 0.) FL_OVERRIDE; void rotate(float angle) FL_OVERRIDE; void translate(int x, int y) FL_OVERRIDE; void untranslate(void) FL_OVERRIDE; int end_page (void) FL_OVERRIDE; void end_job (void) FL_OVERRIDE; void set_current(void) FL_OVERRIDE; bool is_current() FL_OVERRIDE; /** \name These attributes are useful for the Linux/Unix platform only. \{ */ static const char *dialog_title; static const char *dialog_printer; static const char *dialog_range; static const char *dialog_copies; static const char *dialog_all; static const char *dialog_pages; static const char *dialog_from; static const char *dialog_to; static const char *dialog_properties; static const char *dialog_copyNo; static const char *dialog_print_button; static const char *dialog_cancel_button; static const char *dialog_print_to_file; static const char *property_title; static const char *property_pagesize; static const char *property_mode; static const char *property_use; static const char *property_save; static const char *property_cancel; /** \} */ /** The destructor */ ~Fl_Printer(void); }; #endif // Fl_Printer_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Progress.H ================================================ // // Progress bar widget definitions. // // Copyright 2000-2010 by Michael Sweet. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Progress widget . */ #ifndef _Fl_Progress_H_ # define _Fl_Progress_H_ // // Include necessary headers. // #include "Fl_Widget.H" // // Progress class... // /** Displays a progress bar for the user. */ class FL_EXPORT Fl_Progress : public Fl_Widget { float value_, minimum_, maximum_; protected: void draw() FL_OVERRIDE; public: Fl_Progress(int x, int y, int w, int h, const char *l = 0); /** Sets the maximum value in the progress widget. */ void maximum(float v) { maximum_ = v; redraw(); } /** Gets the maximum value in the progress widget. */ float maximum() const { return (maximum_); } /** Sets the minimum value in the progress widget. */ void minimum(float v) { minimum_ = v; redraw(); } /** Gets the minimum value in the progress widget. */ float minimum() const { return (minimum_); } /** Sets the current value in the progress widget. */ void value(float v) { value_ = v; redraw(); } /** Gets the current value in the progress widget. */ float value() const { return (value_); } }; #endif // !_Fl_Progress_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_RGB_Image.H ================================================ // // RGB Image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_RGB_Image_H # define Fl_RGB_Image_H # include "Fl_Image.H" #endif // !Fl_RGB_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Radio_Button.H ================================================ // // Radio button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Radio_Button widget . */ #ifndef Fl_Radio_Button_H #define Fl_Radio_Button_H #include "Fl_Button.H" class FL_EXPORT Fl_Radio_Button : public Fl_Button { public: Fl_Radio_Button(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Radio_Light_Button.H ================================================ // // Radio light button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Radio_Light_Button widget . */ #ifndef Fl_Radio_Light_Button_H #define Fl_Radio_Light_Button_H #include "Fl_Light_Button.H" class FL_EXPORT Fl_Radio_Light_Button : public Fl_Light_Button { public: Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Radio_Round_Button.H ================================================ // // Radio round button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2014 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Radio_Round_Button widget . */ #ifndef Fl_Radio_Round_Button_H #define Fl_Radio_Round_Button_H #include "Fl_Round_Button.H" class FL_EXPORT Fl_Radio_Round_Button : public Fl_Round_Button { public: Fl_Radio_Round_Button(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Rect.H ================================================ // // Fl_Rect header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Rect_H #define Fl_Rect_H #include // for c'tor based on Fl_Widget /** Rectangle with standard FLTK coordinates (X, Y, W, H). This may be used internally, for overloaded widget constructors and other overloaded methods like fl_measure(), fl_text_extents(), fl_rect(), fl_rectf(), and maybe more. */ class FL_EXPORT Fl_Rect { int x_; int y_; int w_; int h_; public: /** The default constructor creates an empty rectangle (x = y = w = h = 0). */ Fl_Rect() : x_(0), y_(0), w_(0), h_(0) {} /** This constructor creates a rectangle with x = y = 0 and the given width and height. */ Fl_Rect(int W, int H) : x_(0), y_(0), w_(W), h_(H) {} /** This constructor creates a rectangle with the given x,y coordinates and the given width and height. */ Fl_Rect(int X, int Y, int W, int H) : x_(X), y_(Y), w_(W), h_(H) {} /** This constructor creates a rectangle with the given x,y coordinates and the given width and height reduced by the box frame size. This is the same as using the constructor w/o \p bt and subsequently calling inset(\p bt). */ Fl_Rect(int X, int Y, int W, int H, Fl_Boxtype bt) : x_(X), y_(Y), w_(W), h_(H) { inset(bt); } /** This constructor creates a rectangle based on a widget's position and size. */ Fl_Rect (const Fl_Widget& widget) : x_(widget.x()), y_(widget.y()), w_(widget.w()), h_(widget.h()) {} /** This constructor creates a rectangle based on a widget's position and size. */ Fl_Rect (const Fl_Widget* const widget) : x_(widget->x()), y_(widget->y()), w_(widget->w()), h_(widget->h()) {} int x() const { return x_; } ///< gets the x coordinate (left edge) int y() const { return y_; } ///< gets the y coordinate (top edge) int w() const { return w_; } ///< gets the width int h() const { return h_; } ///< gets the height /** gets the right edge (x + w). \note r() and b() are coordinates \b outside the area of the rectangle. */ int r() const { return x_ + w_; } /** gets the bottom edge (y + h). \note r() and b() are coordinates \b outside the area of the rectangle. */ int b() const { return y_ + h_; } void x(int X) { x_ = X; } ///< sets the x coordinate (left edge) void y(int Y) { y_ = Y; } ///< sets the y coordinate (top edge) void w(int W) { w_ = W; } ///< sets the width void h(int H) { h_ = H; } ///< sets the height void r(int R) { w_ = R - x_; } ///< sets the width based on R and x void b(int B) { h_ = B - y_; } ///< sets the height based on B and y /** Move all edges in by \p d. Shrinks the rectangle by \p d at all sides keeping the center of the rectangle at the same spot. If \p d is negative, the rectangle is enlarged. If \p d \>= w() or h() the result is undefined, i.e. an invalid or empty rectangle. */ void inset(int d) { x_ += d; y_ += d; w_ -= 2 * d; h_ -= 2 * d; } /** Move all edges in by the frame size of box type \p bt. Shrinks the rectangle at all sides by the frame width or height of the given box type \p bt. This method uses the frame sizes given by the box type \p bt using - Fl::box_dx(bt) - Fl::box_dy(bt) - Fl::box_dw(bt) - Fl::box_dh(bt) If the rectangle is smaller than the frame sizes the result is undefined, i.e. an invalid or empty rectangle. */ void inset(Fl_Boxtype bt) { x_ += Fl::box_dx(bt); y_ += Fl::box_dy(bt); w_ -= Fl::box_dw(bt); h_ -= Fl::box_dh(bt); } /** Move all edges in by \p left, \p top, \p right, \p bottom. Shrinks the rectangle on all sides keeping the center of the rectangle at the same spot. If any value is negative, the rectangle is enlarged. Values are not range checked; it is possible to create an invalid or empty rectangle. */ void inset(int left, int top, int right, int bottom) { x_ += left; y_ += top; w_ -= (left + right); h_ -= (top + bottom); } friend bool operator==(const Fl_Rect& lhs, const Fl_Rect& rhs) { return (lhs.x_==rhs.x_) && (lhs.y_==rhs.y_) && (lhs.w_==rhs.w_) && (lhs.h_==rhs.h_); } friend bool operator!=(const Fl_Rect& lhs, const Fl_Rect& rhs) { return !(lhs==rhs); } }; // class Fl_Rect #endif // Fl_Rect_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Repeat_Button.H ================================================ // // Repeat button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Repeat_Button widget . */ #ifndef Fl_Repeat_Button_H #define Fl_Repeat_Button_H #include "Fl.H" #include "Fl_Button.H" /** The Fl_Repeat_Button is a subclass of Fl_Button that generates a callback when it is pressed and then repeatedly generates callbacks as long as it is held down. The speed of the repeat is fixed and depends on the implementation. */ class FL_EXPORT Fl_Repeat_Button : public Fl_Button { static void repeat_callback(void *); public: int handle(int) FL_OVERRIDE; /** Creates a new Fl_Repeat_Button widget using the given position, size, and label string. The default boxtype is FL_UP_BOX. Deletes the button. */ Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0); void deactivate() { Fl::remove_timeout(repeat_callback,this); Fl_Button::deactivate(); } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Return_Button.H ================================================ // // Return button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Return_Button widget . */ #ifndef Fl_Return_Button_H #define Fl_Return_Button_H #include "Fl_Button.H" /** The Fl_Return_Button is a subclass of Fl_Button that generates a callback when it is pressed or when the user presses the Enter key. A carriage-return symbol is drawn next to the button label. \image html Fl_Return_Button.png \image latex Fl_Return_Button.png "Fl_Return_Button" width=4cm */ class FL_EXPORT Fl_Return_Button : public Fl_Button { protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; /** Creates a new Fl_Return_Button widget using the given position, size, and label string. The default boxtype is FL_UP_BOX.

    The inherited destructor deletes the button. */ Fl_Return_Button(int X, int Y, int W, int H,const char *l=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Roller.H ================================================ // // Roller header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Roller widget . */ #ifndef Fl_Roller_H #define Fl_Roller_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif /** The Fl_Roller widget is a "dolly" control commonly used to move 3D objects. The roller can be controlled by clicking and dragging the mouse, by the corresponding arrow keys when the roller has the keyboard focus, or by the mouse wheels when the mouse pointer is positioned over the roller widget. \image html Fl_Roller.png \image latex Fl_Roller.png "Fl_Roller" width=4cm */ class FL_EXPORT Fl_Roller : public Fl_Valuator { protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Roller(int X,int Y,int W,int H,const char* L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Round_Button.H ================================================ // // Round button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Round_Button_H #define Fl_Round_Button_H #include "Fl_Light_Button.H" /** Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when(). \image html Fl_Round_Button.png \image latex Fl_Round_Button.png "Fl_Round_Button" width=4cm The Fl_Round_Button subclass displays the "on" state by turning on a light, rather than drawing pushed in. The shape of the "light" is initially set to FL_ROUND_DOWN_BOX. The color of the light when on is controlled with selection_color(), which defaults to FL_FOREGROUND_COLOR. */ class FL_EXPORT Fl_Round_Button : public Fl_Light_Button { public: Fl_Round_Button(int x,int y,int w,int h,const char *l = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Round_Clock.H ================================================ // // Round clock header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Round_Clock widget . */ #ifndef Fl_Round_Clock_H #define Fl_Round_Clock_H #include "Fl_Clock.H" /** A clock widget of type FL_ROUND_CLOCK. Has no box. */ class FL_EXPORT Fl_Round_Clock : public Fl_Clock { public: /** Creates the clock widget, setting his type and box. */ Fl_Round_Clock(int X,int Y,int W,int H, const char *L = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_SVG_File_Surface.H ================================================ // // Declaration of Fl_SVG_File_Surface in the Fast Light Tool Kit (FLTK). // // Copyright 2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_SVG_File_Surface_H #define Fl_SVG_File_Surface_H #include #include /** A drawing surface producing a Scalable Vector Graphics (SVG) file. This drawing surface allows to store any FLTK graphics in vectorial form in a "Scalable Vector Graphics" file. \n Usage example: \code Fl_Window *win = ...// Window to draw to a .svg file int ww = win->decorated_w(); int wh = win->decorated_h(); FILE *svg = fl_fopen("/path/to/mywindow.svg", "w"); if (svg) { Fl_SVG_File_Surface *surface = new Fl_SVG_File_Surface(ww, wh, svg); Fl_Surface_Device::push_current(surface); fl_color(FL_WHITE); fl_rectf(0, 0, ww, wh); surface->draw_decorated_window(win); Fl_Surface_Device::pop_current(); delete surface; // the .svg file is not complete until the destructor was run fclose(svg); } \endcode \note FLTK uses the PNG and JPEG libraries to encode images to the SVG format. For this reason, class Fl_SVG_File_Surface is placed in the fltk_images library. If JPEG is not available at application build time, PNG is enough (but produces a quite larger output). If PNG isn't available either, images don't appear in the SVG output. */ class FL_EXPORT Fl_SVG_File_Surface : public Fl_Widget_Surface { int width_, height_; int (*closef_)(FILE*); public: /** Constructor of the SVG drawing surface. \param width,height Width and height of the graphics area in FLTK drawing units \param svg A writable FILE pointer where the SVG data are to be sent. The resulting SVG data are not complete until after destruction of the Fl_SVG_File_Surface object or after calling close(). \param closef If not NULL, the destructor and close() will call \p closef(svg) after all SVG data has been sent. If NULL, \p fclose(svg) is called instead. This allows to close the FILE pointer by, e.g., \p pclose, or, using a function such as \p "int keep_open(FILE*){return 0;}", to keep it open after completion of all output to \p svg. Function \p closef should return non zero to indicate an error. */ Fl_SVG_File_Surface(int width, int height, FILE *svg, int (*closef)(FILE*) = NULL); /** Destructor. The underlying FILE pointer is processed as by close(). */ ~Fl_SVG_File_Surface(); /** Returns the underlying FILE pointer */ FILE *file(); void origin(int x, int y) FL_OVERRIDE; void origin(int *x, int *y) FL_OVERRIDE; void translate(int x, int y) FL_OVERRIDE; void untranslate() FL_OVERRIDE; int printable_rect(int *w, int *h) FL_OVERRIDE; /** Closes the FILE pointer where SVG data is output. The underlying FILE is closed by function fclose() unless another function was set at object's construction time. The only operation possible after this on the Fl_SVG_File_Surface object is its destruction. \return The value returned by the closing function call. */ int close(); }; #endif /* Fl_SVG_File_Surface_H */ ================================================ FILE: Game Trainers/common/include/FL/Fl_SVG_Image.H ================================================ // // SVG Image header file for the Fast Light Tool Kit (FLTK). // // Copyright 2017-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef FL_SVG_IMAGE_H #define FL_SVG_IMAGE_H #include struct NSVGimage; /** The Fl_SVG_Image class supports loading, caching and drawing of scalable vector graphics (SVG) images. The FLTK library performs parsing and rasterization of SVG data using a modified version of the \c nanosvg software (https://github.com/memononen/nanosvg). The software modification allows the option to change the image ratio while performing rasterization. Use Fl_Image::fail() to check if the Fl_SVG_Image failed to load. fail() returns ERR_FILE_ACCESS if the file could not be opened or read, and ERR_FORMAT if the SVG format could not be decoded. If the image has loaded correctly, w(), h(), and d() should return values greater than zero. Rasterization is not done until the image is first drawn or resize() or normalize() is called. Therefore, \ref array is NULL until then. The delayed rasterization ensures an Fl_SVG_Image is always rasterized to the exact screen resolution at which it is drawn. The Fl_SVG_Image class draws images computed by \c nanosvg with the following known limitations - text between \c and marks, - \c image elements, and - statements are not rendered. The FLTK library can optionally be built without SVG support; in that case, class Fl_SVG_Image is unavailable. Example of displaying a hard-coded svg file: \code #include #include #include #include // A black rotated rectangle const char *svg_data = "\n" " \n"; int main(int argc, char **argv) { Fl_SVG_Image *svg = new Fl_SVG_Image(0, svg_data); // create SVG object Fl_Window *win = new Fl_Window(720, 486, "svg test"); Fl_Box *box = new Fl_Box(0, 0, win->w(), win->h()); box->image(svg); // assign svg object to Fl_Box win->end(); win->show(argc,argv); return(Fl::run()); } \endcode Example of displaying an svg image from a file: \code #include // errno #include // strerror #include #include #include #include #include int main(int argc, char **argv) { Fl_Window *win = new Fl_Window(720, 486, "svg test"); Fl_Box *box = new Fl_Box(0, 0, win->w(), win->h()); // Load svg image from disk, assign to a box const char *svgpath = "/var/tmp/simple.svg"; Fl_SVG_Image *svg = new Fl_SVG_Image(svgpath); // load SVG object from disk switch (svg->fail()) { case Fl_Image::ERR_FILE_ACCESS: // File couldn't load? show path + os error to user fl_alert("%s: %s", svgpath, strerror(errno)); return 1; case Fl_Image::ERR_FORMAT: // Parsing error fl_alert("%s: couldn't decode image", svgpath); return 1; } box->image(svg); // assign svg object to box win->end(); win->show(argc,argv); return(Fl::run()); } \endcode Example of fitting an svg image to a resizable Fl_Box: \code #include #include #include class resizable_box : public Fl_Box { public: resizable_box(int w, int h) : Fl_Box(0, 0, w, h, NULL) {} virtual void resize(int x, int y, int w, int h) { image()->scale(w, h, 1, 1); // p3 = proportional, p4 = can_expand Fl_Box::resize(x, y, w, h); } }; int main(int argc, char **argv) { Fl_Window *win = new Fl_Window(130, 130); resizable_box *box = new resizable_box(win->w(), win->h()); Fl_SVG_Image *svg = new Fl_SVG_Image("/path/to/image.svg"); box->image(svg); svg->scale(box->w(), box->h()); win->end(); win->resizable(win); win->show(argc, argv); return Fl::run(); } \endcode */ class FL_EXPORT Fl_SVG_Image : public Fl_RGB_Image { private: typedef struct { NSVGimage* svg_image; int ref_count; } counted_NSVGimage; counted_NSVGimage* counted_svg_image_; bool rasterized_; int raster_w_, raster_h_; bool to_desaturate_; Fl_Color average_color_; float average_weight_; float svg_scaling_(int W, int H); void rasterize_(int W, int H); void cache_size_(int &width, int &height) FL_OVERRIDE; void init_(const char *name, const unsigned char *filedata, size_t length); Fl_SVG_Image(const Fl_SVG_Image *source); public: /** Set this to \c false to allow image re-scaling that alters the image aspect ratio. Upon object creation, proportional is set to \c true, and the aspect ratio is kept constant.*/ bool proportional; Fl_SVG_Image(const char *filename); Fl_SVG_Image(const char *sharedname, const char *svg_data); Fl_SVG_Image(const char *sharedname, const unsigned char *svg_data, size_t length); virtual ~Fl_SVG_Image(); Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Image::copy(); } void resize(int width, int height); void desaturate() FL_OVERRIDE; void color_average(Fl_Color c, float i) FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0) FL_OVERRIDE; void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); } Fl_SVG_Image *as_svg_image() FL_OVERRIDE { return this; } void normalize() FL_OVERRIDE; }; #endif // FL_SVG_IMAGE_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Scheme.H ================================================ // // Scheme header for the Fast Light Tool Kit (FLTK). // // Copyright 2022-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef FL_Fl_Scheme_H_ #define FL_Fl_Scheme_H_ #include class Fl_Scheme { private: static const char **names_; // registered scheme names static int num_schemes_; // number of registered schemes static int alloc_size_; // number of allocated scheme name entries protected: // const char *name_; // the scheme's name // protected constructor - not yet implemented // Fl_Scheme(const char *name); public: // Static methods. // Some of these methods will replace the scheme related methods of class Fl, // for instance Fl::scheme() and Fl::is_scheme(). // Backwards compatibility must be kept though. static const char **names(); /** Return the number of currently registered schemes. \return Number of registered schemes. */ static int num_schemes() { if (!names_) names(); // force initialization return num_schemes_; } // Adding a scheme name must be a public static method in FLTK 1.4.0. // This will later be protected or replaced by another method name. static int add_scheme_name(const char *name); }; // class Fl_Scheme #endif // FL_Fl_Scheme_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_Scheme_Choice.H ================================================ // // Scheme Choice header for the Fast Light Tool Kit (FLTK). // // Copyright 2022-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef FL_Fl_Scheme_Choice_H_ #define FL_Fl_Scheme_Choice_H_ #include #include #include class FL_EXPORT Fl_Scheme_Choice : public Fl_Choice { protected: static void scheme_cb_(Fl_Widget *w, void *); public: Fl_Scheme_Choice(int X, int Y, int W, int H, const char *L = 0); int handle(int event) FL_OVERRIDE; // set the current value according to the active scheme virtual void init_value(); }; // class Fl_Scheme_Choice #endif // FL_Fl_Scheme_Choice_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_Scroll.H ================================================ // // Fl_Scroll header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Scroll widget . */ #ifndef Fl_Scroll_H #define Fl_Scroll_H #include "Fl_Group.H" #include "Fl_Scrollbar.H" /** This container widget lets you maneuver around a set of widgets much larger than your window. If the child widgets are larger than the size of this object then scrollbars will appear so that you can scroll over to them: \image html Fl_Scroll.png \image latex Fl_Scroll.png "Fl_Scroll" width=4cm If all of the child widgets are packed together into a solid rectangle then you want to set box() to FL_NO_BOX or one of the _FRAME types. This will result in the best output. However, if the child widgets are a sparse arrangement you must set box() to a real _BOX type. This can result in some blinking during redrawing, but that can be solved by using a Fl_Double_Window. The Fl_Scroll widget calculates the bounding box of all its children by using their widget positions and sizes (x, y, w, h). Outside labels are not considered. If you need outside labels of any widgets or free space outside of this bounding box you can add a tiny invisible Fl_Box at the relevant corner(s) of the Fl_Scroll widget, for instance: \code Fl_Scroll scroll(100, 100, 200, 200); // Fl_Scroll at (100, 100) Fl_Box(100, 100, 1, 1); // Fl_Box in top left corner Fl_Input(150, 120, 60, 30, "Input:"); // left most widget with label // ... more widgets ... scroll.end(); \endcode By default you can scroll in both directions, and the scrollbars disappear if the data will fit in the area of the scroll. Use Fl_Scroll::type() to change this as follows : - 0 - No scrollbars - Fl_Scroll::HORIZONTAL - Only a horizontal scrollbar. - Fl_Scroll::VERTICAL - Only a vertical scrollbar. - Fl_Scroll::BOTH - The default is both scrollbars. - Fl_Scroll::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. - Fl_Scroll::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. - Fl_Scroll::BOTH_ALWAYS - Both always on. Use scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) : to change what side the scrollbars are drawn on. If the FL_ALIGN_LEFT bit is on, the vertical scrollbar is on the left. If the FL_ALIGN_TOP bit is on, the horizontal scrollbar is on the top. Note that only the alignment flags in scrollbar are considered. The flags in hscrollbar however are ignored. This widget can also be used to pan around a single child widget "canvas". This child widget should be of your own class, with a draw() method that draws the contents. The scrolling is done by changing the x() and y() of the widget, so this child must use the x() and y() to position its drawing. To speed up drawing it should test fl_not_clipped(int x,int y,int w,int h) to find out if a particular area of the widget must be drawn. Another very useful child is a single Fl_Pack, which is itself a group that packs its children together and changes size to surround them. Filling the Fl_Pack with Fl_Tabs groups (and then putting normal widgets inside those) gives you a very powerful scrolling list of individually-openable panels. Fluid lets you create these, but you can only lay out objects that fit inside the Fl_Scroll without scrolling. Be sure to leave space for the scrollbars, as Fluid won't show these either. You cannot use Fl_Window as a child of this since the clipping is not conveyed to it when drawn, and it will draw over the scrollbars and neighboring objects. */ class FL_EXPORT Fl_Scroll : public Fl_Group { int xposition_, yposition_; int oldx, oldy; int scrollbar_size_; static void hscrollbar_cb(Fl_Widget*, void*); static void scrollbar_cb(Fl_Widget*, void*); static void draw_clip(void*,int,int,int,int); protected: // (STR#1895) /// A local struct to manage a region defined by xywh typedef struct { int x,y,w,h; } Fl_Region_XYWH; /// A local struct to manage a region defined by left/right/top/bottom typedef struct { int l; ///< (l)eft "x" position, aka x1 int r; ///< (r)ight "x" position, aka x2 int t; ///< (t)op "y" position, aka y1 int b; ///< (b)ottom "y" position, aka y2 } Fl_Region_LRTB; /// A local struct to manage a scrollbar's xywh region and tab values typedef struct { int x,y,w,h; int pos; ///< scrollbar tab's "position of first line displayed" int size; ///< scrollbar tab's "size of window in lines" int first; ///< scrollbar tab's "number of first line" int total; ///< scrollbar tab's "total number of lines" } Fl_Scrollbar_Data; /** Structure to manage scrollbar and widget interior sizes. This is filled out by recalc_scrollbars() for use in calculations that need to know the visible scroll area size, etc. \version 1.3.3 */ typedef struct { int scrollsize; ///< the effective scrollbar thickness (local or global) Fl_Region_XYWH innerbox; ///< widget's inner box, excluding scrollbars Fl_Region_XYWH innerchild; ///< widget's inner box, including scrollbars Fl_Region_LRTB child; ///< child bounding box: left/right/top/bottom int hneeded; ///< horizontal scrollbar visibility int vneeded; ///< vertical scrollbar visibility Fl_Scrollbar_Data hscroll; ///< horizontal scrollbar region + values Fl_Scrollbar_Data vscroll; ///< vertical scrollbar region + values } ScrollInfo; void recalc_scrollbars(ScrollInfo &si) const; protected: int on_insert(Fl_Widget*, int) FL_OVERRIDE; int on_move(int, int) FL_OVERRIDE; void fix_scrollbar_order(); void bbox(int&,int&,int&,int&) const; void draw() FL_OVERRIDE; public: Fl_Scrollbar scrollbar; Fl_Scrollbar hscrollbar; void resize(int X, int Y, int W, int H) FL_OVERRIDE; int handle(int) FL_OVERRIDE; Fl_Scroll(int X, int Y, int W, int H, const char *L = 0); virtual ~Fl_Scroll(); enum { // values for type() HORIZONTAL = 1, VERTICAL = 2, BOTH = 3, ALWAYS_ON = 4, HORIZONTAL_ALWAYS = 5, VERTICAL_ALWAYS = 6, BOTH_ALWAYS = 7 }; /** Gets the current horizontal scrolling position. */ int xposition() const {return xposition_;} /** Gets the current vertical scrolling position. */ int yposition() const {return yposition_;} void scroll_to(int, int); void clear(); /* delete child n (by index) */ int delete_child(int n) FL_OVERRIDE; /** Gets the current size of the scrollbars' troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbar's width. \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. \see Fl::scrollbar_size(int) */ int scrollbar_size() const { return(scrollbar_size_); } /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets' scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting \p newSize to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. \param[in] newSize Sets the scrollbar size in pixels.\n If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() \see Fl::scrollbar_size() */ void scrollbar_size(int newSize) { if ( newSize != scrollbar_size_ ) redraw(); scrollbar_size_ = newSize; } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Scrollbar.H ================================================ // // Scroll bar header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Scrollbar widget . */ #ifndef Fl_Scrollbar_H #define Fl_Scrollbar_H #include "Fl_Slider.H" /** The Fl_Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar. Clicking on the arrows move up/left and down/right by linesize(). Scrollbars also accept FL_SHORTCUT events: the arrows move by linesize(), and vertical scrollbars take Page Up/Down (they move by the page size minus linesize()) and Home/End (they jump to the top or bottom). Scrollbars have step(1) preset (they always return integers). If desired you can set the step() to non-integer values. You will then have to use casts to get at the floating-point versions of value() from Fl_Slider. \image html scrollbar.png \image latex scrollbar.png "Fl_Scrollbar" width=4cm */ class FL_EXPORT Fl_Scrollbar : public Fl_Slider { int linesize_; int pushed_; static void timeout_cb(void*); void increment_cb(); protected: void draw() FL_OVERRIDE; public: Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0); ~Fl_Scrollbar(); int handle(int) FL_OVERRIDE; /** Gets the integer value (position) of the slider in the scrollbar. You can get the floating point value with Fl_Slider::value(). \see Fl_Scrollbar::value(int p) \see Fl_Scrollbar::value(int pos, int size, int first, int total) */ int value() const {return int(Fl_Slider::value());} /** Sets the value (position) of the slider in the scrollbar. \see Fl_Scrollbar::value() \see Fl_Scrollbar::value(int pos, int size, int first, int total) */ int value(int p) {return int(Fl_Slider::value((double)p));} /** Sets the position, size and range of the slider in the scrollbar. \param[in] pos position, first line displayed \param[in] windowSize number of lines displayed \param[in] first_line number of first line \param[in] total_lines total number of lines You should call this every time your window changes size, your data changes size, or your scroll position changes (even if in response to a callback from this scrollbar). All necessary calls to redraw() are done. Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total). */ int value(int pos, int windowSize, int first_line, int total_lines) { return scrollvalue(pos, windowSize, first_line, total_lines); } /** Get the size of step, in lines, that the arror keys move. */ int linesize() const {return linesize_;} /** This number controls how big the steps are that the arrow keys do. In addition page up/down move by the size last sent to value() minus one linesize(). The default is 16. */ void linesize(int i) {linesize_ = i;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Secret_Input.H ================================================ // // Secret input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Secret_Input widget . */ #ifndef Fl_Secret_Input_H #define Fl_Secret_Input_H #include "Fl_Input.H" /** The Fl_Secret_Input class is a subclass of Fl_Input that displays its input as a string of placeholders. Depending on the platform this placeholder is either the asterisk ('*') or the Unicode bullet character (U+2022). This subclass is usually used to receive passwords and other "secret" information. */ class FL_EXPORT Fl_Secret_Input : public Fl_Input { public: /** Creates a new Fl_Secret_Input widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. Inherited destructor destroys the widget and any value associated with it. */ Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0); int handle(int) FL_OVERRIDE; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Select_Browser.H ================================================ // // Select browser header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Select_Browser widget . */ #ifndef Fl_Select_Browser_H #define Fl_Select_Browser_H #include "Fl_Browser.H" /** The class is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. As long as the mouse button is held down on an unselected item it is highlighted. Normally the callback is done when the user presses the mouse, but you can change this with when().

    See Fl_Browser for methods to add and remove lines from the browser. */ class FL_EXPORT Fl_Select_Browser : public Fl_Browser { public: /** Creates a new Fl_Select_Browser widget using the given position, size, and label string. The default boxtype is FL_DOWN_BOX. The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER. The destructor destroys the widget and frees all memory that has been allocated. */ Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Shared_Image.H ================================================ // // Shared image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Shared_Image class. */ #ifndef Fl_Shared_Image_H # define Fl_Shared_Image_H # include "Fl_Image.H" #undef SHIM_DEBUG /** Test function (typedef) for adding new shared image formats. This defines the function type you can use to add a handler for unknown image formats that can be opened and loaded as an Fl_Shared_Image. fl_register_images() adds all image formats known to FLTK. Call Fl_Shared_Image::add_handler() to add your own check function to the list of known image formats. Your function will be passed the filename (\p name), some \p header bytes already read from the image file and the size \p headerlen of the data read. The max value of size is implementation dependent. If your handler function needs to check more bytes you must open the image file yourself. The provided buffer \p header must not be overwritten. If your handler function can identify the file type you must open the file and return a valid Fl_Image or derived type, otherwise you must return \c NULL. Example: \code static Fl_Image *check_my_image(const char *name, uchar *header, int headerlen) { // (test image type using header and headerlen) if (known) { // (load image data from file \p name) return new Fl_RGB_Image(data, ...); } else return 0; } // add your handler: Fl_Shared_Image::add_handler(check_my_image); \endcode \param[in] name filename to be checked and opened if applicable \param[in] header portion of the file that has already been read \param[in] headerlen length of provided \p header data \returns valid Fl_Image or \c NULL. \see Fl_Shared_Image::add_handler() */ typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header, int headerlen); /** This class supports caching, loading, and drawing of image files. Most applications will also want to link against the fltk_images library and call the fl_register_images() function to support standard image formats such as BMP, GIF, JPEG, PNG, and SVG (unless the library was built with the option removing SVG support). Images can be requested (loaded) with Fl_Shared_Image::get(), find(), and some other methods. All images are cached in an internal list of shared images and should be released when they are no longer needed. A refcount is used to determine if a released image is to be destroyed with delete. \see fl_register_image() \see Fl_Shared_Image::get() \see Fl_Shared_Image::find() \see Fl_Shared_Image::release() */ class FL_EXPORT Fl_Shared_Image : public Fl_Image { friend class Fl_JPEG_Image; friend class Fl_PNG_Image; friend class Fl_SVG_Image; friend class Fl_Graphics_Driver; protected: static Fl_Shared_Image **images_; // Shared images static int num_images_; // Number of shared images static int alloc_images_; // Allocated shared images static Fl_Shared_Handler *handlers_; // Additional format handlers static int num_handlers_; // Number of format handlers static int alloc_handlers_; // Allocated format handlers const char *name_; // Name of image file int original_; // Original image? int refcount_; // Number of times this image has been used Fl_Image *image_; // The image that is shared int alloc_image_; // Was the image allocated? static int compare(Fl_Shared_Image **i0, Fl_Shared_Image **i1); // Use get() and release() to load/delete images in memory... Fl_Shared_Image(); Fl_Shared_Image(const char *n, Fl_Image *img = 0); virtual ~Fl_Shared_Image(); void add(); void update(); Fl_Shared_Image *copy_(int W, int H) const; public: #ifdef SHIM_DEBUG static void print_pool(); #endif /** Returns the filename of the shared image */ const char *name() { return name_; } /** Returns the number of references of this shared image. When reference is below 1, the image is deleted. */ int refcount() { return refcount_; } /** Returns whether this is an original image. Images loaded from a file or from memory are marked \p original as opposed to images created as a copy of another image with different size (width or height). \note This is useful for debugging (rarely used in user code). \since FLTK 1.4.0 */ int original() { return original_; } void release() FL_OVERRIDE; virtual void reload(); Fl_Shared_Image *as_shared_image() FL_OVERRIDE { return this; } Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const; Fl_Image *copy(); void color_average(Fl_Color c, float i) FL_OVERRIDE; void desaturate() FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0) FL_OVERRIDE; void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); } void uncache() FL_OVERRIDE; static Fl_Shared_Image *find(const char *name, int W = 0, int H = 0); static Fl_Shared_Image *get(const char *name, int W = 0, int H = 0); static Fl_Shared_Image *get(Fl_RGB_Image *rgb, int own_it = 1); static Fl_Shared_Image **images(); static int num_images(); static void add_handler(Fl_Shared_Handler f); static void remove_handler(Fl_Shared_Handler f); /** Returns a pointer to the internal Fl_Image object. The output is a pointer to the \p internal image ('Fl_Image' or subclass) which can be used to inspect or copy the image. Do not try to modify the image! You can copy the image though if you want or need to change any attributes, size etc. If all you need to do is to resize the image you should use Fl_Shared_Image::copy(int, int) instead. \note The internal image (pointer) is protected for good reasons, e.g. to prevent access to the image so it can't be modified by user code. \b DO \b NOT cast away the 'const' attribute to modify the image. User code should rarely need this method. Use with caution. \return const Fl_Image* image, the internal Fl_Image \since 1.4.0 */ const Fl_Image *image() const { return image_; } }; // class Fl_Shared_Image // // The following function is provided in the fltk_images library and // registers all of the "extra" image file formats that are not part // of the core FLTK library... // FL_EXPORT extern void fl_register_images(); #endif // !Fl_Shared_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Shortcut_Button.H ================================================ // // Shortcut Button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Shortcut_Button_H #define Fl_Shortcut_Button_H #include class FL_EXPORT Fl_Shortcut_Button : public Fl_Button { private: bool hot_, pre_hot_, default_set_, handle_default_button_; Fl_Shortcut pre_esc_; Fl_Shortcut default_shortcut_; protected: Fl_Shortcut shortcut_value; void do_end_hot_callback(); int handle(int) FL_OVERRIDE; void draw() FL_OVERRIDE; public: Fl_Shortcut_Button(int X,int Y,int W,int H, const char* l = 0); void value(Fl_Shortcut shortcut); Fl_Shortcut value(); #if 0 // Default shortcut settings are disabled until successful review of the UI void default_value(Fl_Shortcut shortcut); Fl_Shortcut default_value(); void default_clear(); #endif }; #endif // Fl_Shortcut_Button_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Simple_Counter.H ================================================ // // Simple counter header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Simple_Counter widget . */ #ifndef Fl_Simple_Counter_H #define Fl_Simple_Counter_H #include "Fl_Counter.H" /** This widget creates a counter with only 2 arrow buttons \image html counter.png \image latex counter.png "Fl_Simple_Counter" width=4cm */ class FL_EXPORT Fl_Simple_Counter : public Fl_Counter { public: Fl_Simple_Counter(int X,int Y,int W,int H, const char *L = 0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Single_Window.H ================================================ // // Single-buffered window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Single_Window class . */ #ifndef Fl_Single_Window_H #define Fl_Single_Window_H #include "Fl_Window.H" /** This is the same as Fl_Window. However, it is possible that some implementations will provide double-buffered windows by default. This subclass can be used to force single-buffering. This may be useful for modifying existing programs that use incremental update, or for some types of image data, such as a movie flipbook. */ class FL_EXPORT Fl_Single_Window : public Fl_Window { public: void show() FL_OVERRIDE; /** Same as Fl_Window::show(int argc, char **argv) */ void show(int argc, char **argv) { Fl_Window::show(argc, argv);} /** Creates a new Fl_Single_Window widget using the given size, and label (title) string. */ Fl_Single_Window(int W, int H, const char *l=0); /** Creates a new Fl_Single_Window widget using the given position, size, and label (title) string. */ Fl_Single_Window(int X, int Y, int W, int H, const char *l=0); /** Same as Fl_Window::make_current() */ void make_current() { Fl_Window::make_current(); } /** Same as Fl_Window::flush() */ void flush() FL_OVERRIDE { Fl_Window::flush(); } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Slider.H ================================================ // // Slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Slider widget . */ #ifndef Fl_Slider_H #define Fl_Slider_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif // values for type(), lowest bit indicate horizontal: #define FL_VERT_SLIDER 0 #define FL_HOR_SLIDER 1 #define FL_VERT_FILL_SLIDER 2 #define FL_HOR_FILL_SLIDER 3 #define FL_VERT_NICE_SLIDER 4 #define FL_HOR_NICE_SLIDER 5 /** The Fl_Slider widget contains a sliding knob inside a box. It is often used as a scrollbar. Moving the box all the way to the top/left sets it to the minimum(), and to the bottom/right to the maximum(). The minimum() may be greater than the maximum() to reverse the slider direction. Use void Fl_Widget::type(int) to set how the slider is drawn, which can be one of the following: \li FL_VERTICAL - Draws a vertical slider (this is the default). \li FL_HORIZONTAL - Draws a horizontal slider. \li FL_VERT_FILL_SLIDER - Draws a filled vertical slider, useful as a progress or value meter. \li FL_HOR_FILL_SLIDER - Draws a filled horizontal slider, useful as a progress or value meter. \li FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice looking control knob. \li FL_HOR_NICE_SLIDER - Draws a horizontal slider with a nice looking control knob. \image html slider.png \image latex slider.png "Fl_Slider" width=4cm */ class FL_EXPORT Fl_Slider : public Fl_Valuator { float slider_size_; uchar slider_; void _Fl_Slider(); void draw_bg(int, int, int, int); protected: // these allow subclasses to put the slider in a smaller area: void draw(int, int, int, int); int handle(int, int, int, int, int); void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Slider(int X,int Y,int W,int H, const char *L = 0); Fl_Slider(uchar t,int X,int Y,int W,int H, const char *L); int scrollvalue(int pos,int size,int first,int total); void bounds(double a, double b); /** Get the dimensions of the moving piece of slider. */ float slider_size() const {return slider_size_;} /** Set the dimensions of the moving piece of slider. This is the fraction of the size of the entire widget. If you set this to 1 then the slider cannot move. The default value is .08. For the "fill" sliders this is the size of the area around the end that causes a drag effect rather than causing the slider to jump to the mouse. */ void slider_size(double v); /** Gets the slider box type. */ Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;} /** Sets the slider box type. */ void slider(Fl_Boxtype c) {slider_ = c;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Spinner.H ================================================ // // Spinner widget for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Spinner widget . */ #ifndef Fl_Spinner_H #define Fl_Spinner_H #include #include #include #include /** This widget is a combination of a numerical input widget and repeat buttons. The user can either type into the input area or use the buttons to change the value. \image html Fl_Spinner.png "Fl_Spinner widget" \image latex Fl_Spinner.png "Fl_Spinner widget" width=6cm */ class FL_EXPORT Fl_Spinner : public Fl_Group { double value_; // Current value double minimum_; // Minimum value double maximum_; // Maximum value double step_; // Amount to add/subtract for up/down const char *format_; // Format string for input field int wrap_; // wrap around at bounds (1/0) private: static void sb_cb(Fl_Widget *w, Fl_Spinner *sb); // internal callback void update(); // update input field protected: // This class works like Fl_Input but ignores FL_Up and FL_Down key // presses so they are handled by its parent, the Fl_Spinner widget. // See STR #2989. class FL_EXPORT Fl_Spinner_Input : public Fl_Input { public: Fl_Spinner_Input(int X, int Y, int W, int H) : Fl_Input(X, Y, W, H) {} int handle(int event) FL_OVERRIDE; // implemented in src/Fl_Spinner.cxx }; Fl_Spinner_Input input_; // Input field for the value Fl_Repeat_Button up_button_, // Up button down_button_; // Down button void draw() FL_OVERRIDE; public: // Constructor Fl_Spinner(int X, int Y, int W, int H, const char *L = 0); // Event handling int handle(int event) FL_OVERRIDE; // Resize group and subwidgets void resize(int X, int Y, int W, int H) FL_OVERRIDE; /** Returns the format string for the value. */ const char *format() const { return (format_); } /** Sets the format string for the value. */ void format(const char *f) { format_ = f; update(); } /** Gets the maximum value of the widget. */ double maximum() const { return (maximum_); } /** Sets the maximum value of the widget. */ void maximum(double m) { maximum_ = m; } /** Gets the minimum value of the widget. */ double minimum() const { return (minimum_); } /** Sets the minimum value of the widget. */ void minimum(double m) { minimum_ = m; } /** Sets the minimum and maximum values for the widget. */ void range(double a, double b) { minimum_ = a; maximum_ = b; } // Sets the amount to change the value when the user clicks a button. // Docs in src/Fl_Spinner.cxx void step(double s); /** Gets the amount to change the value when the user clicks a button. \see Fl_Spinner::step(double) */ double step() const { return (step_); } /** Sets whether the spinner wraps around at upper and lower bounds. If wrap mode is on the spinner value is set to the minimum() or maximum() if the value exceeds the upper or lower bounds, resp., if it was changed by one of the buttons or the FL_Up or FL_Down keys. The spinner stops at the upper and lower bounds if wrap mode is off. The default wrap mode is on for backwards compatibility with FLTK 1.3.x and older versions. \note Wrap mode does not apply to the input field if the input value is edited directly as a number. The input value is always clipped to the allowed range as if wrap mode was off when the input field is left (i.e. loses focus). \see minimum(), maximum() \param[in] set non-zero sets wrap mode, zero resets wrap mode \since 1.4.0 */ void wrap(int set) { wrap_ = set ? 1 : 0; } /** Gets the wrap mode of the Fl_Spinner widget. \see void wrap(int) \since 1.4.0 */ int wrap() const { return wrap_; } /** Gets the color of the text in the input field. */ Fl_Color textcolor() const { return (input_.textcolor()); } /** Sets the color of the text in the input field. */ void textcolor(Fl_Color c) { input_.textcolor(c); } /** Gets the font of the text in the input field. */ Fl_Font textfont() const { return (input_.textfont()); } /** Sets the font of the text in the input field. */ void textfont(Fl_Font f) { input_.textfont(f); } /** Gets the size of the text in the input field. */ Fl_Fontsize textsize() const { return (input_.textsize()); } /** Sets the size of the text in the input field. */ void textsize(Fl_Fontsize s) { input_.textsize(s); } // Sets the numeric representation in the input field. // Docs see src/Fl_Spinner.cxx void type(uchar v); /** Gets the numeric representation in the input field. \see Fl_Spinner::type(uchar) */ uchar type() const { return (input_.type()); } /** Gets the current value of the widget. */ double value() const { return (value_); } /** Sets the current value of the input widget. Before setting value to a non-integer value, the spinner type() should be changed to floating point. */ void value(double v) { value_ = v; update(); } /** Sets the background color of the spinner widget's input field. */ void color(Fl_Color v) { input_.color(v); } /** Returns the background color of the spinner widget's input field. */ Fl_Color color() const { return(input_.color()); } /** Sets the selection color of the spinner widget's input field. */ void selection_color(Fl_Color val) { input_.selection_color(val); } /** Returns the selection color of the spinner widget's input field. */ Fl_Color selection_color() const { return input_.selection_color(); } /** Sets the maximum width of the input field. */ void maximum_size(int m) { if (m > 0) input_.maximum_size(m); } /** Returns the maximum width of the input field. */ int maximum_size() const { return input_.maximum_size(); } }; #endif // !Fl_Spinner_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Sys_Menu_Bar.H ================================================ // // MacOS system menu bar header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Definition of class Fl_Sys_Menu_Bar. */ #ifndef Fl_Sys_Menu_Bar_H #define Fl_Sys_Menu_Bar_H #include class Fl_Sys_Menu_Bar_Driver; /** A class to create and modify menus that appear on macOS in the menu bar at the top of the screen. On other than macOS platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar. On the macOS platform, replace Fl_Menu_Bar with Fl_Sys_Menu_Bar, and a system menu at the top of the screen will be available. This menu will match an array of Fl_Menu_Item's exactly as in all other FLTK menus (except for the submenu with the application's own name and the 'Window' menu; see below). There is, though, an important difference between an Fl_Sys_Menu_Bar object under macOS and under other platforms: only a single object from this class can be created, because macOS uses a single system menu bar. Therefore, porting to macOS an app that creates, on other platforms, several Fl_Menu_Bar objects, one for each of several windows, is more complex that just replacing Fl_Menu_Bar by Fl_Sys_Menu_Bar. On the macOS platform, the system menu bar of any FLTK app begins with the Application menu which the FLTK library automatically constructs. Functions Fl_Mac_App_Menu::custom_application_menu_items() and Fl_Sys_Menu_Bar::about() can be used to further customize the Application menu. The FLTK library also automatically constructs and handles a Window menu which can be further customized (or even removed) calling Fl_Sys_Menu_Bar::window_menu_style(window_menu_style_enum style). Other member functions of this class allow the app to generate the rest of the system menu bar. It is recommended to localize the system menu bar using the standard Mac OS X localization procedure (see \ref osissues_localize). Changes to the menu state are immediately visible in the menubar when they are made using member functions of the Fl_Sys_Menu_Bar class. Other changes (e.g., by a call to Fl_Menu_Item::set()) should be followed by a call to update() to be visible in the menubar across all platforms. macOS global variable \ref fl_sys_menu_bar points to the unique, current system menu bar. A few FLTK menu features are not supported by the Mac System menu: \li no symbolic labels \li no embossed labels \li no font sizes As described above, the submenu with the application's own name (usually the second submenu from the left, immediately following the "Apple" submenu) is a special case, and can be managed with Fl_Mac_App_Menu::custom_application_menu_items(). For example, to make your own "Appname -> Preferences" dialog, you might use: \code #include // for Fl_Mac_App_Menu class #include // for Fl_Menu_Item : void prefs_cb(Fl_Widget *w, void *data) { // ..Open your preferences dialog here.. } : int main(..) { : // Items to add to the application menu static Fl_Menu_Item appitems[] = { { "Preferences", 0, prefs_cb, 0, 0 }, { 0 }, { 0 } }; Fl_Mac_App_Menu::custom_application_menu_items(appitems); // adds it } \endcode ..the result being: \image html mac-app-menu-preferences.png "Mac Application submenu" \image latex mac-app-menu-preferences.png "Mac Application submenu" width=4cm */ class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar { static Fl_Sys_Menu_Bar_Driver *driver(); protected: void draw() FL_OVERRIDE; public: /** Possible styles of the Window menu in the system menu bar */ typedef enum { no_window_menu = 0, ///< No Window menu in the system menu bar tabbing_mode_none, ///< No tabbed windows, but the system menu bar contains a Window menu tabbing_mode_automatic, ///< Windows are created by themselves but can be tabbed later tabbing_mode_preferred ///< Windows are tabbed when created } window_menu_style_enum; Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0); virtual ~Fl_Sys_Menu_Bar(); /** Return the system menu's array of Fl_Menu_Item's */ const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();} void menu(const Fl_Menu_Item *m); void update() FL_OVERRIDE; void play_menu(const Fl_Menu_Item *) FL_OVERRIDE; int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0); /** Adds a new menu item. \see Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */ int add(const char* label, const char* shortcut, Fl_Callback* cb, void *user_data=0, int flags=0) { return add(label, fl_old_shortcut(shortcut), cb, user_data, flags); } int add(const char* str); int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0); /** Insert a new menu item. \see Fl_Menu_::insert(int index, const char* label, const char* shortcut, Fl_Callback *cb, void *user_data=0, int flags=0) */ int insert(int index, const char* label, const char* shortcut, Fl_Callback *cb, void *user_data=0, int flags=0) { return insert(index, label, fl_old_shortcut(shortcut), cb, user_data, flags); } void remove(int n); void replace(int index, const char *name); void clear(); int clear_submenu(int index); void mode (int i, int fl); /** Gets the flags of item i. */ int mode(int i) const { return Fl_Menu_::mode(i); } void shortcut (int i, int s); void setonly (Fl_Menu_Item *item); static void about(Fl_Callback *cb, void *data); static window_menu_style_enum window_menu_style(); static void window_menu_style(window_menu_style_enum style); static void create_window_menu(); }; /** The system menu bar. */ extern Fl_Sys_Menu_Bar *fl_sys_menu_bar; #endif // Fl_Sys_Menu_Bar_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Table.H ================================================ // // Fl_Table -- A table widget for the Fast Light Tool Kit (FLTK). // // Copyright 2002 by Greg Ercolano. // Copyright (c) 2004 O'ksi'D // Copyright 2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef _FL_TABLE_H #define _FL_TABLE_H #include #include // EXPERIMENTAL // We use either std::vector or the private class Fl_Int_Vector // depending on the build option FLTK_OPTION_STD or --enable-use_std. // This option allows to use std::string and std::vector in FLTK 1.4.x #if (FLTK_USE_STD) #include typedef std::vector Fl_Int_Vector; #else class Fl_Int_Vector; // private class declared in src/Fl_Int_Vector.H #endif /** A table of widgets or other content. This is the base class for table widgets. To be useful it must be subclassed and several virtual functions defined. Normally applications use widgets derived from this widget, and do not use this widget directly; this widget is usually too low level to be used directly by applications. This widget does \em not handle the data in the table. The draw_cell() method must be overridden by a subclass to manage drawing the contents of the cells. This widget can be used in several ways: - As a custom widget; see examples/table-simple.cxx and test/table.cxx. Very optimal for even extremely large tables. - As a table made up of a single FLTK widget instanced all over the table, simulating a numeric spreadsheet. See examples/table-spreadsheet.cxx and examples/table-spreadsheet-with-keyboard-nav.cxx. Optimal for large tables. - As a regular container of FLTK widgets, one widget per cell. See examples/table-as-container.cxx. \em Not recommended for large tables. \image html table-simple.png \image latex table-simple.png "table-simple example" width=6cm \image html table-as-container.png \image latex table-as-container.png "table-as-container example" width=6cm When acting as part of a custom widget, events on the cells and/or headings generate callbacks when they are clicked by the user. You control when events are generated based on the setting for Fl_Table::when(). When acting as a container for FLTK widgets, the FLTK widgets maintain themselves. Although the draw_cell() method must be overridden, its contents can be very simple. See the draw_cell() code in examples/table-simple.cxx. The following variables are available to classes deriving from Fl_Table: \anchor table_dimensions_diagram \image html table-dimensions.png \image latex table-dimensions.png "Fl_Table Dimensions" width=6cm
    x()/y()/w()/h() Fl_Table widget's outer dimension. The outer edge of the border of the Fl_Table. (Red in the diagram above)
    wix/wiy/wiw/wih Fl_Table widget's inner dimension. The inner edge of the border of the Fl_Table. eg. if the Fl_Table's box() is FL_NO_BOX, these values are the same as x()/y()/w()/h(). (Yellow in the diagram above)
    tox/toy/tow/toh The table's outer dimension. The outer edge of the border around the cells, but inside the row/col headings and scrollbars. (Green in the diagram above)
    tix/tiy/tiw/tih The table's inner dimension. The inner edge of the border around the cells, but inside the row/col headings and scrollbars. AKA the table's clip region. eg. if the table_box() is FL_NO_BOX, these values are the same as tox/toy/tow/toh. (Blue in the diagram above)
    CORE DEVELOPERS - Greg Ercolano : 12/16/2002 - initial implementation 12/16/02. Fl_Table, Fl_Table_Row, docs. - Jean-Marc Lienher : 02/22/2004 - added keyboard nav + mouse selection, and ported Fl_Table into fltk-utf8-1.1.4 OTHER CONTRIBUTORS - Inspired by the Feb 2000 version of FLVW's Flvw_Table widget. Mucho thanks to those folks. - Mister Satan : 04/07/2003 - MinGW porting mods, and singleinput.cxx; a cool Fl_Input oriented spreadsheet example - Marek Paliwoda : 01/08/2003 - Porting mods for Borland - Ori Berger : 03/16/2006 - Optimizations for >500k rows/cols LICENSE Greg kindly gave his permission to integrate Fl_Table and Fl_Table_Row into FLTK, allowing FLTK license to apply while his widgets are part of the library. [updated by Greg, 04/26/17] */ class FL_EXPORT Fl_Table : public Fl_Group { public: /** The context bit flags for Fl_Table related callbacks. Should be used in draw_cell() to determine what's being drawn, or in a callback() to determine where a recent event occurred. */ enum TableContext { CONTEXT_NONE = 0, ///< no known context CONTEXT_STARTPAGE = 0x01, ///< before the table is redrawn CONTEXT_ENDPAGE = 0x02, ///< after the table is redrawn CONTEXT_ROW_HEADER = 0x04, ///< drawing or event occurred in the row header CONTEXT_COL_HEADER = 0x08, ///< drawing or event occurred in the col header CONTEXT_CELL = 0x10, ///< drawing or event occurred in a cell CONTEXT_TABLE = 0x20, ///< drawing or event occurred in a dead zone of table CONTEXT_RC_RESIZE = 0x40 ///< column or row is being resized }; private: int _rows, _cols; // total rows/cols int _row_header_w; // width of row header int _col_header_h; // height of column header int _row_position; // last row_position set (not necessarily == toprow!) int _col_position; // last col_position set (not necessarily == leftcol!) char _row_header; // row header enabled? char _col_header; // col header enabled? char _row_resize; // row resizing enabled? char _col_resize; // col resizing enabled? int _row_resize_min; // row minimum resizing height (default=1) int _col_resize_min; // col minimum resizing width (default=1) // OPTIMIZATION: partial row/column redraw variables int _redraw_toprow; int _redraw_botrow; int _redraw_leftcol; int _redraw_rightcol; Fl_Color _row_header_color; Fl_Color _col_header_color; int _auto_drag; int _selecting; int _scrollbar_size; enum { TABCELLNAV = 1<<0 ///> tab cell navigation flag }; unsigned int flags_; Fl_Int_Vector *_colwidths; // column widths in pixels Fl_Int_Vector *_rowheights; // row heights in pixels // number of columns and rows == size of corresponding vectors int col_size(); // size of the column widths vector int row_size(); // size of the row heights vector Fl_Cursor _last_cursor; // last mouse cursor before changed to 'resize' cursor // EVENT CALLBACK DATA TableContext _callback_context; // event context int _callback_row, _callback_col; // event row/col // handle() state variables. // Put here instead of local statics in handle(), so more // than one Fl_Table can exist without crosstalk between them. // int _resizing_col; // column being dragged int _resizing_row; // row being dragged int _dragging_x; // starting x position for horiz drag int _dragging_y; // starting y position for vert drag int _last_row; // last row we FL_PUSH'ed // Redraw single cell void _redraw_cell(TableContext context, int R, int C); void _start_auto_drag(); void _stop_auto_drag(); void _auto_drag_cb(); static void _auto_drag_cb2(void *d); protected: enum ResizeFlag { RESIZE_NONE = 0, RESIZE_COL_LEFT = 1, RESIZE_COL_RIGHT = 2, RESIZE_ROW_ABOVE = 3, RESIZE_ROW_BELOW = 4 }; int table_w; ///< table's virtual width (in pixels) int table_h; ///< table's virtual height (in pixels) int toprow; ///< top row# of currently visible table on screen int botrow; ///< bottom row# of currently visible table on screen int leftcol; ///< left column# of currently visible table on screen int rightcol; ///< right column# of currently visible table on screen // selection int current_row; ///< selection cursor's current row (-1 if none) int current_col; ///< selection cursor's current column (-1 if none) int select_row; ///< extended selection row (-1 if none) int select_col; ///< extended selection column (-1 if none) // OPTIMIZATION: Precomputed scroll positions for the toprow/leftcol int toprow_scrollpos; ///< precomputed scroll position for top row int leftcol_scrollpos; ///< precomputed scroll position for left column // Data table's inner dimension int tix; ///< Data table's inner x dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int tiy; ///< Data table's inner y dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int tiw; ///< Data table's inner w dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int tih; ///< Data table's inner h dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" // Data table's outer dimension int tox; ///< Data table's outer x dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int toy; ///< Data table's outer y dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int tow; ///< Data table's outer w dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int toh; ///< Data table's outer h dimension, outside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" // Table widget's inner dimension int wix; ///< Table widget's inner x dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int wiy; ///< Table widget's inner y dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int wiw; ///< Table widget's inner w dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" int wih; ///< Table widget's inner h dimension, inside bounding box. See \ref table_dimensions_diagram "Table Dimension Diagram" Fl_Scroll *table; ///< child Fl_Scroll widget container for child fltk widgets (if any) Fl_Scrollbar *vscrollbar; ///< child vertical scrollbar widget Fl_Scrollbar *hscrollbar; ///< child horizontal scrollbar widget // Fltk int handle(int e) FL_OVERRIDE; // fltk handle() FL_OVERRIDE // Class maintenance void recalc_dimensions(); void table_resized(); // table resized; recalc void table_scrolled(); // table scrolled; recalc void get_bounds(TableContext context, // return x/y/w/h bounds for context int &X, int &Y, int &W, int &H); void change_cursor(Fl_Cursor newcursor); // change mouse cursor to some other shape TableContext cursor2rowcol(int &R, int &C, ResizeFlag &resizeflag); int find_cell(TableContext context, // find cell's x/y/w/h given r/c int R, int C, int &X, int &Y, int &W, int &H); int row_col_clamp(TableContext context, int &R, int &C); // clamp r/c to known universe /** Subclass should override this method to handle drawing the cells. This method will be called whenever the table is redrawn, once per cell. Only cells that are completely (or partially) visible will be told to draw. \p context will be one of the following:
    \p Fl_Table::CONTEXT_STARTPAGE When table, or parts of the table, are about to be redrawn.
    Use to initialize static data, such as font selections.

    R/C will be zero,
    X/Y/W/H will be the dimensions of the table's entire data area.
    (Useful for locking a database before accessing; see also visible_cells())

    \p Fl_Table::CONTEXT_ENDPAGE When table has completed being redrawn.
    R/C will be zero, X/Y/W/H dimensions of table's data area.
    (Useful for unlocking a database after accessing)
    \p Fl_Table::CONTEXT_ROW_HEADER Whenever a row header cell needs to be drawn.
    R will be the row number of the header being redrawn,
    C will be zero,
    X/Y/W/H will be the fltk drawing area of the row header in the window
    \p Fl_Table::CONTEXT_COL_HEADER Whenever a column header cell needs to be drawn.
    R will be zero,
    C will be the column number of the header being redrawn,
    X/Y/W/H will be the fltk drawing area of the column header in the window
    \p Fl_Table::CONTEXT_CELL Whenever a data cell in the table needs to be drawn.
    R/C will be the row/column of the cell to be drawn,
    X/Y/W/H will be the fltk drawing area of the cell in the window
    \p Fl_Table::CONTEXT_RC_RESIZE Whenever table or row/column is resized or scrolled, either interactively or via col_width() or row_height().
    R/C/X/Y/W/H will all be zero.

    Useful for fltk containers that need to resize or move the child fltk widgets.

    \p R and \p C will be set to the row and column number of the cell being drawn. In the case of row headers, \p C will be \a 0. In the case of column headers, \p R will be \a 0. X/Y/W/H will be the position and dimensions of where the cell should be drawn. In the case of custom widgets, a minimal draw_cell() override might look like the following. With custom widgets it is up to the caller to handle drawing everything within the dimensions of the cell, including handling the selection color. Note all clipping must be handled as well; this allows drawing outside the dimensions of the cell if so desired for 'custom effects'. \code // This is called whenever Fl_Table wants you to draw a cell void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) { static char s[40]; sprintf(s, "%d/%d", R, C); // text for each cell switch ( context ) { case CONTEXT_STARTPAGE: // Fl_Table telling us it's starting to draw page fl_font(FL_HELVETICA, 16); return; case CONTEXT_ROW_HEADER: // Fl_Table telling us to draw row/col headers case CONTEXT_COL_HEADER: fl_push_clip(X, Y, W, H); { fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color()); fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); } fl_pop_clip(); return; case CONTEXT_CELL: // Fl_Table telling us to draw cells fl_push_clip(X, Y, W, H); { // BG COLOR fl_color(is_selected(R, C) ? selection_color() : FL_WHITE); fl_rectf(X, Y, W, H); // TEXT fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); // BORDER fl_color(FL_LIGHT2); fl_rect(X, Y, W, H); } fl_pop_clip(); return; default: return; } //NOTREACHED } \endcode */ virtual void draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) { (void)context; (void)R; (void)C; (void)X; (void)Y; (void)W; (void)H;} // overridden by deriving class long row_scroll_position(int row); // find scroll position of row (in pixels) long col_scroll_position(int col); // find scroll position of col (in pixels) /** Does the table contain any child fltk widgets? */ int is_fltk_container() { // does table contain fltk widgets? return( Fl_Group::children() > 3 ); // (ie. more than box and 2 scrollbars?) } static void scroll_cb(Fl_Widget*,void*); // h/v scrollbar callback void damage_zone(int r1, int c1, int r2, int c2, int r3 = 0, int c3 = 0); /** Define region of cells to be redrawn by specified range of rows/cols, and then sets damage(DAMAGE_CHILD). Extends any previously defined range to redraw. */ void redraw_range(int topRow, int botRow, int leftCol, int rightCol) { if ( _redraw_toprow == -1 ) { // Initialize redraw range _redraw_toprow = topRow; _redraw_botrow = botRow; _redraw_leftcol = leftCol; _redraw_rightcol = rightCol; } else { // Extend redraw range if ( topRow < _redraw_toprow ) _redraw_toprow = topRow; if ( botRow > _redraw_botrow ) _redraw_botrow = botRow; if ( leftCol < _redraw_leftcol ) _redraw_leftcol = leftCol; if ( rightCol > _redraw_rightcol ) _redraw_rightcol = rightCol; } // Indicate partial redraw needed of some cells damage(FL_DAMAGE_CHILD); } // draw() has to be protected per FLTK convention (was public in 1.3.x) void draw() FL_OVERRIDE; public: Fl_Table(int X, int Y, int W, int H, const char *l=0); ~Fl_Table(); /** Clears the table to zero rows (rows(0)), zero columns (cols(0)), and clears any widgets (table->clear()) that were added with begin()/end() or add()/insert()/etc. \see rows(int), cols(int) */ virtual void clear() { rows(0); cols(0); table->clear(); } // \todo: add topline(), middleline(), bottomline() /** Sets the kind of box drawn around the data table, the default being FL_NO_BOX. Changing this value will cause the table to redraw. */ inline void table_box(Fl_Boxtype val) { table->box(val); table_resized(); } /** Returns the current box type used for the data table. */ inline Fl_Boxtype table_box( void ) { return(table->box()); } virtual void rows(int val); // set number of rows /** Returns the number of rows in the table. */ inline int rows() { return(_rows); } virtual void cols(int val); // set number of columns /** Get the number of columns in the table. */ inline int cols() { return(_cols); } /** Returns the range of row and column numbers for all visible and partially visible cells in the table. These values can be used e.g. by your draw_cell() routine during CONTEXT_STARTPAGE to figure out what cells are about to be redrawn for the purposes of locking the data from a database before it's drawn. \code leftcol rightcol : : toprow .. .-------------------. | | | V I S I B L E | | | | T A B L E | | | botrow .. '-------------------` \endcode e.g. in a table where the visible rows are 5-20, and the visible columns are 100-120, then those variables would be: - toprow = 5 - botrow = 20 - leftcol = 100 - rightcol = 120 */ inline void visible_cells(int& r1, int& r2, int& c1, int& c2) { r1 = toprow; r2 = botrow; c1 = leftcol; c2 = rightcol; } /** Returns 1 if someone is interactively resizing a row or column. You can currently call this only from within your callback(). */ int is_interactive_resize() { return(_resizing_row != -1 || _resizing_col != -1); } /** Returns if row resizing by the user is allowed. */ inline int row_resize() { return(_row_resize); } /** Allows/disallows row resizing by the user. 1=allow interactive resizing, 0=disallow interactive resizing. Since interactive resizing is done via the row headers, row_header() must also be enabled to allow resizing. */ void row_resize(int flag) { // enable row resizing _row_resize = flag; } /** Returns if column resizing by the user is allowed. */ inline int col_resize() { return(_col_resize); } /** Allows/disallows column resizing by the user. 1=allow interactive resizing, 0=disallow interactive resizing. Since interactive resizing is done via the column headers, \p col_header() must also be enabled to allow resizing. */ void col_resize(int flag) { // enable col resizing _col_resize = flag; } /** Returns the current column minimum resize value. */ inline int col_resize_min() { // column minimum resizing width return(_col_resize_min); } /** Sets the current column minimum resize value. This is used to prevent the user from interactively resizing any column to be smaller than 'pixels'. Must be a value >=1. */ void col_resize_min(int val) { _col_resize_min = ( val < 1 ) ? 1 : val; } /** Returns the current row minimum resize value. */ inline int row_resize_min() { // column minimum resizing width return(_row_resize_min); } /** Sets the current row minimum resize value. This is used to prevent the user from interactively resizing any row to be smaller than 'pixels'. Must be a value >=1. */ void row_resize_min(int val) { _row_resize_min = ( val < 1 ) ? 1 : val; } /** Returns if row headers are enabled or not. */ inline int row_header() { // set/get row header enable flag return(_row_header); } /** Enables/disables showing the row headers. 1=enabled, 0=disabled. If changed, the table is redrawn. */ void row_header(int flag) { _row_header = flag; table_resized(); redraw(); } /** Returns if column headers are enabled or not. */ inline int col_header() { // set/get col header enable flag return(_col_header); } /** Enable or disable column headers. If changed, the table is redrawn. */ void col_header(int flag) { _col_header = flag; table_resized(); redraw(); } /** Sets the height in pixels for column headers and redraws the table. */ inline void col_header_height(int height) { // set/get col header height _col_header_h = height; table_resized(); redraw(); } /** Gets the column header height. */ inline int col_header_height() { return(_col_header_h); } /** Sets the row header width to n and causes the screen to redraw. */ inline void row_header_width(int width) { // set/get row header width _row_header_w = width; table_resized(); redraw(); } /** Returns the current row header width (in pixels). */ inline int row_header_width() { return(_row_header_w); } /** Sets the row header color and causes the screen to redraw. */ inline void row_header_color(Fl_Color val) { // set/get row header color _row_header_color = val; redraw(); } /** Returns the current row header color. */ inline Fl_Color row_header_color() { return(_row_header_color); } /** Sets the color for column headers and redraws the table. */ inline void col_header_color(Fl_Color val) { // set/get col header color _col_header_color = val; redraw(); } /** Gets the color for column headers. */ inline Fl_Color col_header_color() { return(_col_header_color); } void row_height(int row, int height); // set row height in pixels // Returns the current height of the specified row as a value in pixels. int row_height(int row); void col_width(int col, int width); // set a column's width in pixels // Returns the current width of the specified column in pixels. int col_width(int col); /** Convenience method to set the height of all rows to the same value, in pixels. The screen is redrawn. */ void row_height_all(int height) { // set all row/col heights for ( int r=0; rinit_sizes(); table->redraw(); } /** The specified widget is removed from its current group (if any) and added to the end of Fl_Table's group. */ void add(Fl_Widget& wgt) { table->add(wgt); if ( table->children() > 2 ) { table->show(); } else { table->hide(); } } /** The specified widget is removed from its current group (if any) and added to the end of Fl_Table's group. */ void add(Fl_Widget* wgt) { add(*wgt); } /** The specified widget is removed from its current group (if any) and inserted into the Fl_Table's group at position 'n'. */ void insert(Fl_Widget& wgt, int n) { table->insert(wgt,n); } /** The specified widget is removed from its current group (if any) and inserted into Fl_Table's group before widget 'w2'. This will append if 'w2' is not in Fl_Table's group. */ void insert(Fl_Widget& wgt, Fl_Widget* w2) { table->insert(wgt,w2); } /** The specified widget is removed from Fl_Table's group. */ void remove(Fl_Widget& wgt) { table->remove(wgt); } // (doxygen will substitute Fl_Group's docs here) void begin() { table->begin(); } // (doxygen will substitute Fl_Group's docs here) void end() { table->end(); // HACK: Avoid showing Fl_Scroll; seems to erase screen // causing unnecessary flicker, even if its box() is FL_NO_BOX. // if ( table->children() > 2 ) { table->show(); } else { table->hide(); } Fl_Group::current(Fl_Group::parent()); } /** Returns a pointer to the array of children. This pointer is only valid until the next time a child is added or removed. */ Fl_Widget*const* array() { return(table->array()); } /** Returns the child widget by an index. When using the Fl_Table as a container for FLTK widgets, this method returns the widget pointer from the internal array of widgets in the container. Typically used in loops, eg: \code for ( int i=0; ichild(n)); } /** Returns the number of children in the table. When using the Fl_Table as a container for FLTK widgets, this method returns how many child widgets the table has. \see child(int) */ int children() const { return(table->children()-2); // -2: skip Fl_Scroll's h/v scrollbar widgets } // (doxygen will substitute Fl_Group's docs here) int find(const Fl_Widget *wgt) const { return(table->find(wgt)); } // (doxygen will substitute Fl_Group's docs here) int find(const Fl_Widget &wgt) const { return(table->find(wgt)); } // CALLBACKS /** Returns the current row the event occurred on. This function should only be used from within the user's callback function. */ int callback_row() { return(_callback_row); } /** Returns the current column the event occurred on. This function should only be used from within the user's callback function. */ int callback_col() { return(_callback_col); } /** Returns the current 'table context'. This function should only be used from within the user's callback function. */ TableContext callback_context() { return(_callback_context); } /** Calls the widget callback. Saves the specified 'context', 'row', and 'col' values, so that the user's callback can then access them with the member functions callback_context(), callback_row() and callback_col(). */ void do_callback(TableContext context, int row, int col) { _callback_context = context; _callback_row = row; _callback_col = col; Fl_Widget::do_callback(); } #ifdef FL_DOXYGEN /** The Fl_Widget::when() function is used to set a group of flags, determining when the widget callback is called:
    \p FL_WHEN_CHANGED callback() will be called when rows or columns are resized (interactively or via col_width() or row_height()), passing CONTEXT_RC_RESIZE via callback_context().
    \p FL_WHEN_RELEASE callback() will be called during FL_RELEASE events, such as when someone releases a mouse button somewhere on the table.
    The callback() routine is sent a TableContext that indicates the context the event occurred in, such as in a cell, in a header, or elsewhere on the table. When an event occurs in a cell or header, callback_row() and callback_col() can be used to determine the row and column. The callback can also look at the regular fltk event values (ie. Fl::event() and Fl::event_button()) to determine what kind of event is occurring. */ void when(Fl_When flags); #endif #ifdef FL_DOXYGEN /** Callbacks will be called depending on the setting of Fl_Widget::when(). Callback functions should use the following functions to determine the context/row/column: - Fl_Table::callback_row() returns current row - Fl_Table::callback_col() returns current column - Fl_Table::callback_context() returns current table context callback_row() and callback_col() will be set to the row and column number the event occurred on. If someone clicked on a row header, \p col will be \a 0. If someone clicked on a column header, \p row will be \a 0. callback_context() will return one of the following:
    Fl_Table::CONTEXT_ROW_HEADER Someone clicked on a row header. Excludes resizing.
    Fl_Table::CONTEXT_COL_HEADER Someone clicked on a column header. Excludes resizing.
    Fl_Table::CONTEXT_CELL Someone clicked on a cell. To receive callbacks for FL_RELEASE events, you must set when(FL_WHEN_RELEASE).
    Fl_Table::CONTEXT_RC_RESIZE Someone is resizing rows/columns either interactively, or via the col_width() or row_height() API. Use is_interactive_resize() to determine interactive resizing. If resizing a column, R=0 and C=column being resized. If resizing a row, C=0 and R=row being resized. NOTE: To receive resize events, you must set when(FL_WHEN_CHANGED).
    \code class MyTable : public Fl_Table { [..] private: // Handle events that happen on the table void event_callback2() { int R = callback_row(), // row where event occurred C = callback_col(); // column where event occurred TableContext context = callback_context(); // which part of table fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n", R, C, (int)context, (int)Fl::event()); } // Actual static callback static void event_callback(Fl_Widget*, void* data) { MyTable *o = (MyTable*)data; o->event_callback2(); } public: // Constructor MyTable() { [..] table.callback(&event_callback, (void*)this); // setup callback table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it } }; \endcode */ void callback(Fl_Widget*, void*); #endif /** Gets the current size of the scrollbars' troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbar's width. \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. \see Fl::scrollbar_size(int) */ int scrollbar_size() const { return(_scrollbar_size); } /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets' scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting \p newSize to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. \param[in] newSize Sets the scrollbar size in pixels.\n If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() \see Fl::scrollbar_size() */ void scrollbar_size(int newSize) { if ( newSize != _scrollbar_size ) redraw(); _scrollbar_size = newSize; } /** Flag to control if Tab navigates table cells or not. If on, Tab key navigates table cells. If off, Tab key navigates fltk widget focus. (default) As of fltk 1.3, the default behavior of the Tab key is to navigate focus off of the current widget, and on to the next one. But in some applications, it's useful for Tab to be used to navigate cells in the Fl_Table. \param [in] val If \p val is 1, Tab key navigates cells in table, not fltk widgets.
    If \p val is 0, Tab key will advance focus to the next fltk widget (default), and does not navigate cells in table. */ void tab_cell_nav(int val) { if ( val ) flags_ |= TABCELLNAV; else flags_ &= ~TABCELLNAV; } /** Get state of table's 'Tab' key cell navigation flag. \returns 1 if Tab configured to navigate cells in table
    0 to navigate widget focus (default) \see tab_cell_nav(int) */ int tab_cell_nav() const { return(flags_ & TABCELLNAV ? 1 : 0); } }; #endif /*_FL_TABLE_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Table_Row.H ================================================ // #ifndef _FL_TABLE_ROW_H #define _FL_TABLE_ROW_H // // Fl_Table_Row -- A row oriented table widget for the Fast Light Tool Kit (FLTK). // // A class specializing in a table of rows. // Handles row-specific selection behavior. // // Copyright 2002 by Greg Ercolano. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #include /** A table with row selection capabilities. This class implements a simple table with the ability to select rows. This widget is similar to an Fl_Browser with columns. Most methods of importance will be found in the Fl_Table widget, such as Fl_Table::rows() and Fl_Table::cols(). To be useful it must be subclassed and at minimum the draw_cell() method must be overridden to provide the content of the cells. This widget does \em not manage the cell's data content; it is up to the parent class's draw_cell() method override to provide this. Events on the cells and/or headings generate callbacks when they are clicked by the user. You control when events are generated based on the values you supply for Fl_Table::when(). */ class FL_EXPORT Fl_Table_Row : public Fl_Table { public: enum TableRowSelectMode { SELECT_NONE, // no selection allowed SELECT_SINGLE, // single row selection SELECT_MULTI // multiple row selection (default) }; private: // An STL-ish vector without templates class FL_EXPORT CharVector { char *arr; int _size; void init() { arr = 0; _size = 0; } void copy(char *newarr, int newsize); public: CharVector() { // CTOR init(); } ~CharVector(); // DTOR CharVector(CharVector&o) { // COPY CTOR init(); copy(o.arr, o._size); } CharVector& operator=(CharVector&o) { // ASSIGN init(); copy(o.arr, o._size); return(*this); } char operator[](int x) const { return(arr[x]); } char& operator[](int x) { return(arr[x]); } int size() { return(_size); } void size(int count); char pop_back() { char tmp = arr[_size-1]; _size--; return(tmp); } void push_back(char val) { int x = _size; size(_size+1); arr[x] = val; } char back() { return(arr[_size-1]); } }; CharVector _rowselect; // selection flag for each row // handle() state variables. // Put here instead of local statics in handle(), so more // than one instance can exist without crosstalk between. // int _dragging_select; // dragging out a selection? int _last_row; int _last_y; // last event's Y position int _last_push_x; // last PUSH event's X position int _last_push_y; // last PUSH event's Y position TableRowSelectMode _selectmode; protected: int handle(int event) FL_OVERRIDE; int find_cell(TableContext context, // find cell's x/y/w/h given r/c int R, int C, int &X, int &Y, int &W, int &H) { return(Fl_Table::find_cell(context, R, C, X, Y, W, H)); } public: /** The constructor for the Fl_Table_Row. This creates an empty table with no rows or columns, with headers and row/column resize behavior disabled. */ Fl_Table_Row(int X, int Y, int W, int H, const char *l=0) : Fl_Table(X,Y,W,H,l) { _dragging_select = 0; _last_row = -1; _last_y = -1; _last_push_x = -1; _last_push_y = -1; _selectmode = SELECT_MULTI; } /** The destructor for the Fl_Table_Row. Destroys the table and its associated widgets. */ ~Fl_Table_Row() { } void rows(int val) FL_OVERRIDE; // set number of rows int rows() { // get number of rows return(Fl_Table::rows()); } /** Sets the table selection mode. - \p Fl_Table_Row::SELECT_NONE - No selection allowed - \p Fl_Table_Row::SELECT_SINGLE - Only single rows can be selected - \p Fl_Table_Row::SELECT_MULTI - Multiple rows can be selected */ void type(TableRowSelectMode val); // set selection mode TableRowSelectMode type() const { // get selection mode return(_selectmode); } // Checks to see if 'row' is selected. Returns 1 if selected, 0 if not. int row_selected(int row); // Changes the selection state for 'row', depending on the value of 'flag'. int select_row(int row, int flag = 1); /** This convenience function changes the selection state for \em all rows based on 'flag'. 0=deselect, 1=select, 2=toggle existing state. */ void select_all_rows(int flag=1); // all rows to a known state void clear() FL_OVERRIDE { rows(0); // implies clearing selection cols(0); Fl_Table::clear(); // clear the table } }; #endif /*_FL_TABLE_ROW_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Tabs.H ================================================ // // Tab header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Tabs widget . */ #ifndef Fl_Tabs_H #define Fl_Tabs_H #include "Fl_Group.H" struct Fl_Menu_Item; /** The Fl_Tabs widget is a container widget that displays a set of tabs, with each tab representing a different child widget. The user can select a tab by clicking on it, and the corresponding child widget will be displayed. The Fl_Tabs widget is useful for organizing a large number of controls or other widgets into a compact space, allowing the user to switch between different sets of controls as needed. \image html tabs.png \image latex tabs.png "Fl_Tabs" width=8cm Clicking the tab makes a child visible() by calling show() on it, and all other children are made invisible by calling hide() on them. Usually the children are Fl_Group widgets containing several widgets themselves. Each child makes a card, and its label() is printed on the card tab, including the label font and style. The selection color of that child is used to color the tab, while the color of the child determines the background color of the pane. '&' in labels are used to prefix a shortcut that is drawn underlined and that activates the corresponding tab; repeated '&&' avoids that. The size of the tabs is controlled by the bounding box of the children (there should be some space between the children and the edge of the Fl_Tabs), and the tabs may be placed "inverted" on the bottom - this is determined by which gap is larger. It is easiest to lay this out in FLUID, using the FLUID browser to select each child group and resize them until the tabs look the way you want them to. \b Note: The widgets contained in each child should leave some clear space (five pixels as of FLTK 1.4.x) at the top or bottom of the group (where the tabs are displayed). Otherwise drawing the children may interfere with the selection border between the tabs and the children. This is particularly important if the child group is an Fl_Scroll widget: either the Fl_Scroll widget must be inset by five pixels relative to other children or it can be wrapped inside another Fl_Group and inset by five pixels within this group so the contents of the Fl_Scroll widget are kept away from the tabs by this amount. The background area behind and to the right of the tabs is "transparent", exposing the background detail of the parent. The value of Fl_Tabs::box() does not affect this area. So if Fl_Tabs is resized by itself without the parent, force the appropriate parent (visible behind the tabs) to redraw() to prevent artifacts. See "Resizing Caveats" below on how to keep tab heights constant. See "Callback's Use Of when()" on how to control the details of how clicks invoke the callback(). A typical use of the Fl_Tabs widget: \par \code // Typical use of Fl_Tabs Fl_Tabs *tabs = new Fl_Tabs(10,10,300,200); { Fl_Group *grp1 = new Fl_Group(20,30,280,170,"Tab1"); { ..widgets that go in tab#1.. } grp1->end(); Fl_Group *grp2 = new Fl_Group(20,30,280,170,"Tab2"); { ..widgets that go in tab#2.. } grp2->end(); } tabs->end(); \endcode \b Default \b Appearance The appearance of each "tab" is taken from the label() and color() of the child group corresponding to that "tab" and panel. Where the "tabs" appear depends on the position and size of the child groups that make up the panels within the Fl_Tabs widget, i.e. whether there is more space above or below them. The height of the "tabs" depends on how much free space is available. \image html tabs_default.png "Fl_Tabs Default Appearance" \image latex tabs_default.png "Fl_Tabs Default Appearance" width=8cm \b Highlighting \b The \b Selected \b Tab The selected "tab" can be highlighted further by setting the selection_color() of the Fl_Tab itself, e.g. \par \code .. tabs = new Fl_Tabs(..); tabs->selection_color(FL_DARK3); .. \endcode The result of the above looks like: \image html tabs_selection.png "Highlighting the selected tab" \image latex tabs_selection.png "Highlighting the selected tab" width=8cm \b Uniform \b Tab \b and \b Panel \b Appearance In order to have uniform tab and panel appearance, not only must the color() and selection_color() for each child group be set, but also the selection_color() of the Fl_Tab itself any time a new "tab" is selected. This can be achieved within the Fl_Tab callback, e.g. \par \code void MyTabCallback(Fl_Widget *w, void*) { Fl_Tabs *tabs = (Fl_Tabs*)w; // When tab changed, make sure it has same color as its group tabs->selection_color( (tabs->value())->color() ); } .. int main(..) { // Define tabs widget tabs = new Fl_Tabs(..); tabs->callback(MyTabCallback); // Create three tabs each colored differently grp1 = new Fl_Group(.. "One"); grp1->color(9); grp1->selection_color(9); grp1->end(); grp2 = new Fl_Group(.. "Two"); grp2->color(10); grp2->selection_color(10); grp2->end(); grp3 = new Fl_Group(.. "Three"); grp3->color(14); grp3->selection_color(14); grp3->end(); .. // Make sure default tab has same color as its group tabs->selection_color( (tab->value())->color() ); .. return Fl::run(); } \endcode The result of the above looks like: \image html tabs_uniform.png "Fl_Tabs with uniform colors" \image latex tabs_uniform.png "Fl_Tabs with uniform colors" width=8cm If Fl_Tabs has no children, the widget will be drawn as a flat rectangle in the background color set by \ref color(). \b Close \b Button \b on \b Tabs The Fl_Tabs widget allows you to specify that a child widget should display a close button in its tab. If the \ref FL_WHEN_CLOSED flag is set for the child widget, an "X" symbol will be displayed to the left of the label text in the tab. When the close button is clicked, the child widget's callback function will be called with the \ref FL_REASON_CLOSED reason. It is then the responsibility of the child widget to remove itself from the Fl_Tabs container. Tabs that are in a compressed state will not display a close button until they are fully expanded. \b Overflowing \b Tabs When the combined width of the tabs exceeds that of the Fl_Tabs widget, the tabs will overflow. Fl_Tabs provides four options for managing tabs overflow: - Fl_Tabs::OVERFLOW_COMPRESS: proportionally compress the tabs to the left and right of the selected tab until they all fit within the widget. - Fl_Tabs::OVERFLOW_CLIP: clip any tabs that extend beyond the right edge of the Fl_Tabs widget, making some tabs unreachable. - Fl_Tabs::OVERFLOW_PULLDOWN: don't compress the tabs but instead generate a pulldown menu at the right end of the tabs area, displaying all available tabs. - Fl_Tabs::OVERFLOW_DRAG: maintain the tabs' original sizes, allowing horizontal dragging of the tabs area using the mouse, a horizontal mouse wheel, or the horizontal scrolling gesture on touchpads. \b Resizing \b Caveats When Fl_Tabs is resized vertically, the default behavior scales the tab's height as well as its children. To keep the tab height constant during resizing, set the tab widget's resizable() to one of the tab's child groups, i.e. \par \code tabs = new Fl_Tabs(..); grp1 = new Fl_Group(..); .. grp2 = new Fl_Group(..); .. tabs->end(); tabs->resizable(grp1); // keeps tab height constant \endcode \par Callback's Use Of when() As of FLTK 1.3.3, Fl_Tabs() supports the following flags for when(): - \ref FL_WHEN_NEVER -- callback never invoked (all flags off) - \ref FL_WHEN_CHANGED -- if flag set, invokes callback when a tab has been changed (on click or keyboard navigation) - \ref FL_WHEN_NOT_CHANGED -- if flag set, invokes callback when the tabs remain unchanged (on click or keyboard navigation) - \ref FL_WHEN_RELEASE -- if flag set, invokes callback on RELEASE of mouse button or keyboard navigation Notes: -# The above flags can be logically OR-ed (|) or added (+) to combine behaviors. -# The default value for when() is \ref FL_WHEN_RELEASE (inherited from Fl_Widget). -# If \ref FL_WHEN_RELEASE is the \em only flag specified, the behavior will be as if (\ref FL_WHEN_RELEASE|\ref FL_WHEN_CHANGED) was specified. -# The value of changed() will be valid during the callback. -# If both \ref FL_WHEN_CHANGED and \ref FL_WHEN_NOT_CHANGED are specified, the callback is invoked whether the tab has been changed or not. The changed() method can be used to determine the cause. -# \ref FL_WHEN_NOT_CHANGED can happen if someone clicks on an already selected tab, or if a keyboard navigation attempt results in no change to the tabs, such as using the arrow keys while at the left or right end of the tabs. -# \ref Fl::callback_reason() returns FL_REASON_SELECTED or FL_REASON_RESELECTED */ class FL_EXPORT Fl_Tabs : public Fl_Group { Fl_Widget *push_; protected: int overflow_type; ///< \see OVERFLOW_COMPRESS, OVERFLOW_CLIP, etc. int tab_offset; ///< for pulldown and drag overflow, this is the horizontal offset when the tabs bar is dragged by the user int *tab_pos; ///< Array of x-offsets of tabs per child + 1 \see tab_positions() int *tab_width; ///< Array of widths of tabs per child \see tab_positions() int *tab_flags; ///< Array of tab flag of tabs per child \see tab_positions() int tab_count; ///< Array size of tab positions etc. \see tab_positions() Fl_Align tab_align_; ///< tab label alignment int has_overflow_menu;///< set in OVERFLOW_PULLDOWN mode if tabs overflow. The actual menu array is created only on demand void take_focus(Fl_Widget *o); int maybe_do_callback(Fl_Widget *o); void check_overflow_menu(); void handle_overflow_menu(); void draw_overflow_menu_button(); int on_insert(Fl_Widget*, int) FL_OVERRIDE; int on_move(int, int) FL_OVERRIDE; void on_remove(int) FL_OVERRIDE; virtual void redraw_tabs(); virtual int tab_positions(); // allocate and calculate tab positions virtual void clear_tab_positions(); virtual void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int flags, int sel); virtual int tab_height(); virtual int hit_close(Fl_Widget *o, int event_x, int event_y); virtual int hit_overflow_menu(int event_x, int event_y); virtual int hit_tabs_area(int event_x, int event_y); void draw() FL_OVERRIDE; public: Fl_Tabs(int X, int Y, int W, int H, const char *L = 0); ~Fl_Tabs() FL_OVERRIDE; void resize(int, int, int, int) FL_OVERRIDE; void show() FL_OVERRIDE; int handle(int) FL_OVERRIDE; Fl_Widget *value(); int value(Fl_Widget *); /** Returns the tab group for the tab the user has currently down-clicked on and remains over until FL_RELEASE. Otherwise, returns NULL. While the user is down-clicked on a tab, the return value is the tab group for that tab. But as soon as the user releases, or drags off the tab with the button still down, the return value will be NULL. \see push(Fl_Widget*). */ Fl_Widget *push() const { return push_; } int push(Fl_Widget *); virtual Fl_Widget *which(int event_x, int event_y); void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0); /** Sets the tab label alignment. The default is FL_ALIGN_CENTER so tab labels are centered, but since the label space is measured (per label) to fit the labels, there wouldn't be any difference if labels were aligned left or right. If you want to show an image (icon) next to the group's label you can set a different label alignment. FL_ALIGN_IMAGE_NEXT_TO_TEXT is the recommended alignment to show the icon left of the text. */ void tab_align(Fl_Align a) { tab_align_ = a; } /** Gets the tab label alignment. \see tab_align(Fl_Align) */ Fl_Align tab_align() const { return tab_align_; } enum { OVERFLOW_COMPRESS = 0, ///< Tabs will be compressed and overlaid on top of each other. OVERFLOW_CLIP, ///< Only the first tabs that fit will be displayed. OVERFLOW_PULLDOWN, ///< Tabs that do not fit will be placed in a pull-down menu. OVERFLOW_DRAG ///< The tab bar can be dragged horizontally to reveal additional tabs. }; void handle_overflow(int ov); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Terminal.H ================================================ // // Fl_Terminal - A terminal widget for Fast Light Tool Kit (FLTK). // // Copyright 2022 by Greg Ercolano. // Copyright 2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Terminal widget. */ #ifndef Fl_Terminal_H #define Fl_Terminal_H #include #include #include #include #include #include // va_list (MinGW) /** \class Fl_Terminal \brief Terminal widget supporting Unicode/utf-8, ANSI/xterm escape codes with full RGB color control. \section Fl_Terminal \image html Fl_Terminal-demo.png "Fl_Terminal widget showing a linux manual page" \image latex Fl_Terminal-demo.png "Fl_Terminal widget showing a linux manual page" width=6cm Fl_Terminal is an output-only text widget supporting ASCII and UTF-8/Unicode. It supports most terminal text features, such as most VT100/xterm style escape sequences (see \ref Fl_Terminal_escape_codes), text colors/attributes, scrollback history, mouse selection, etc. It is recommended that accessing features such as setting text colors and cursor positioning is best done with ANSI/XTERM escape sequences. But if one sets ansi(false) then this is not possible, so the public API can be used for common operations, e.g. \par Public API | ESC code equivalent | Description | ------------------------|--------------------------|-----------------------------| clear_screen_home() | ESC [ H ESC [ 2 J | Clear screen, home cursor | cursor_home() | ESC [ H | Home the cursor | clear_history() | ESC [ 3 J | Clear scrollback history | reset_terminal() | ESC [ c | Reset terminal | To access more advanced API calls, one can derive a class from Fl_Terminal to access protected methods manipulate the terminal more directly, e.g. \par Protected API | ESC code equiv. | Description | -----------------------------|------------------|-----------------------------------------| current_style() | ESC [ # m | Set text attributes | clear_eod() | ESC [ 0 J | Clear from cursor to end of display | clear_sod() | ESC [ 1 J | Clear from cursor to start of display | clear_eol() | ESC [ 0 K | Clear from cursor to end of line | clear_sol() | ESC [ 1 K | Clear from cursor to start of line | clear_line() | ESC [ 2 K | Clear line cursor is on | scroll(int) // >0 for up | ESC [ 1 S | Scroll up one line | scroll(int) // <0 for down | ESC [ 1 T | Scroll down one line | cursor_left() | ESC [ 1 D | Move cursor left (no wrap) | cursor_right() | ESC [ 1 C | Move cursor right (no wrap) | cursor_up() | ESC [ 1 B | Move cursor up (no scroll or wrap) | cursor_down() | ESC [ 1 A | Move cursor down (no scroll or wrap) | cursor_row() cursor_col() | ESC [ # ; # H | Move cursor to row# / column# | insert_char() | ESC [ # @ | Insert a char at cursor position | delete_chars() | ESC [ # P | Delete chars at cursor position | insert_rows() | ESC [ # L | Insert rows at cursor position | delete_rows() | ESC [ # M | Delete rows at cursor position | etc... | etc... | etc... | Many commonly used API functions are public, such as textfgcolor() for setting text colors. Others, such as cursor_up() are protected to prevent common misuse, and are available only to subclasses. Some common operations: - Set the terminal's background color, see color(Fl_Color) - Set the terminal's default text color, see textfgcolor_default(Fl_Color) - Printing text to the terminal, see Fl_Terminal::printf() and Fl_Terminal::append() - Clearing the screen, see clear() - Getting the terminal's buffer contents, see text() - Getting single utf8 characters by row/col from the terminal display, see utf8_char_at_disp() - Getting the text from a text selection, see get_selection() For applications that need input support, the widget can be subclassed to provide keyboard input, and advanced features like pseudo ttys, termio, serial port I/O, etc., as such features are beyond the scope of FLTK. \subsection Fl_Terminal_Examples Examples \par \code // // Fl_Terminal: Simple Use // Fl_Terminal *tty = new Fl_Terminal(...); : tty->append("Hello world.\n"); // simple strings tty->append("\033[31mThis text is red.\033[0m\n"); // colored text tty->append("\033[32mThis text is green.\033[0m\n"); tty->printf("The value of x is %.02f\n", x); // printf() formatting \endcode \par There are also public methods for doing what most "\033[" escape codes do, so that if ansi(bool) is set to "false", one can still change text colors or clear the screen via application control, e.g. \par \code tty->home(); // home the cursor tty->clear_screen(); // clear the screen tty->textfgcolor(0xff000000); // change the text color to RED tty->textbgcolor(0x0000ff00); // change the background color to BLUE // ├┘├┘├┘ // R G B \endcode \par When creating the widget, the width/height determine the default column and row count for the terminal's display based on the current font size. The column width determines where text will wrap. \par You can specify wider column sizes than the screen using display_columns(colwidth). When this value is larger than the widget's width, text will wrap off-screen, and can be revealed by resizing the widget wider. \subsection Fl_Terminal_Writing Writing To Terminal From Applications \par An application needing terminal output as part of its user interface can instance Fl_Terminal, and write text strings with: \par - append() to append strings - printf() to append formatted strings \par Single character output can be done with: \par - print_char() to print a single ASCII/UTF-8 char at the cursor - plot_char() to put single ASCII/UTF-8 char at an x,y position \par \subsection Fl_Terminal_Attributes Text Attributes \par The terminal's text supports these attributes: \par - Italic - italicized text: \\033[3m - Bold - brighter/thicker text: \\033[1m - Dim - lower brightness text: \\033[2m - Underline - text that is underlined: \\033[4m - Strikeout - text that has a line through the text: \\033[9m - Inverse - text whose background and foreground colors are swapped: \\033[7m - Normal - normal text: \\033[0m \par \image html Fl_Terminal-utf8-demo.png "Fl_Terminal screen" \image latex Fl_Terminal-utf8-demo.png "Fl_Terminal screen" width=6cm \subsection Fl_Terminal_Colors Text and Background Colors \par There's at least two ways to specify colors for text and background colors: \par - 3 bit / 8 Color Values - Full 24 bit R/G/B colors \par Example of 3 bit colors: \image html Fl_Terminal-3bit-colors.png "Fl_Terminal 3 bit colors" \image latex Fl_Terminal-3bit-colors.png "Fl_Terminal 3 bit colors" width=6cm \par Example application source code using 3 bit colors: \code // // Text colors // tty->append("\033[31m Red text.\033[0m\n"); // Print red text.. tty->append("\033[32m Green text.\033[0m\n"); : tty->append("\033[36m Cyan text.\033[0m\n"); tty->append("\033[37m White text.\033[0m\n"); // // Background colors // tty->append("\033[41m Red Background.\033[0m\n"); // background will be red tty->append("\033[42m Green Background.\033[0m\n"); : tty->append("\033[46m Cyan Background.\033[0m\n"); tty->append("\033[47m White Background.\033[0m\n"); \endcode \par Example of 24 bit colors: \image html Fl_Terminal-24bit-colors.png "Fl_Terminal 24 bit colors" \image latex Fl_Terminal-24bit-colors.png "Fl_Terminal 24 bit colors" width=6cm \par Example application source code using 24 bit colors: \code // // 24 bit Text Color // tty->append("\033[38;2;0;0;255m Text is BLUE.\033[0m\n"); // RGB: R=0, G=0, B=255 tty->append("\033[38;2;255;0;0m Text is RED.\033[0m\n"); // RGB: R=255, G=0, B=0 tty->append("\033[38;2;127;64;0m Text is DARK ORANGE.\033[0m\n"); // RGB: R=127, G=64, B=0 // // 24 bit Background Color // tty->append("\033[48;2;0;0;255m Background is BLUE.\033[0m\n"); // RGB: R=0, G=0, B=255 tty->append("\033[48;2;255;0;0m Background is RED.\033[0m\n"); // RGB: R=255, G=0, B=0 tty->append("\033[48;2;127;64;0m Background is DARK ORANGE.\033[0m\n"); // RGB: R=127, G=64, B=0 \endcode \par For more on the ANSI escape codes, see \ref Fl_Terminal_escape_codes. \subsection Fl_Terminal_Features Features \par Most standard terminal behaviors are supported, e.g. \par - ASCII + UTF-8/Unicode - scrollback history management - mouse selection + copy/paste (^C, ^A) - autoscroll during selection \par Most popular ANSI/DEC VT100/Xterm escape sequences are supported (see \ref Fl_Terminal_escape_codes), including: - per-character colors for text and background - per-character text attributes: bold/dim, underline, strikeout - scrolling up/down - character insert/delete for characters/rows/screen - clearing characters/rows/screen \par Does not (yet) support: - programmable regions (scroll regions and attribute blocks) - dynamic line wrap (where resizing display dynamically re-wraps long lines) \par Will likely never implement as part of this widget: - pty/termio management (such features should be _subclassed_) - Different per-character font family + sizes (font family/size is global only) - variable width fonts \par Regarding the font family+size; the way the terminal is currently designed, the font family and size must not vary within text; rows have to be consistent height. Varying widths are tricky too, esp. when it comes to moving the cursor up/down within a column; varying *widths* are supported (due to Unicode characters sometimes being "wide", but not heights. \subsection Fl_Terminal_Margins Margins \par The margins define the amount of space (in pixels) around the outside of the text display area, the space between the widget's inner edge (inside the box()) and the text display area's outer edge. The margins can be inspected and changed with the margin_left(), margin_right(), margin_top() and margin_bottom() methods. \par \code · TERMINAL WIDGET (Fl_Terminal) ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━┓ ┃ ↑ margin_top ┃ ┃ ┃ TEXT DISPLAY AREA ↓ ┃ ┃ ┃ ┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬─▴─┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐ ┃ ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ S ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ c ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ display_rows ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ r ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ o ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ l ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ l ┃ ┃ │◄── display_columns ─────────┼───────────────────────────►│ ┃ ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ B ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ a ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ r ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ ┃ ┃ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ┃ ┃ ┃◄─┬─►├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼ │ ┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤◄─┬─►┃ ┃ ┃ │ └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─▾─┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘ │ ┃ ┃ ┃ margin_left ↑ margin_right ┃ ┃ ┃ ↓ margin_bottom ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━┛ Fl_Terminal Margins ░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░░░░░░░░ ░░░░░░:::::::::::::░░░░░◉ ░░░░░░::##:::::##:◉░░░░░░╲ ░░░░░░::###:::###::╲░░░░░ ╲ ░░░░░░::####:####::░╲░░░░ Fl_Terminal::color() ░░░░░░::##:###:##::░░╲░░░ ░░░░░░::##::#::##::░░░╲░░ ░░░░░░::##:.:::##::░░░░╲░ ░░░░░░::##:::::#◉::░░░░░╲ ░░░░░░:::::::::::╲:░░░░░░╲ ░░░░░░░░░░░░░░░░░░╲░░░░░░ Fl_Terminal::textbgcolor() ░░░░░░░░░░░░░░░░░░░╲░░░░░ ╲ Fl_Terminal::textfgcolor() · \endcode \subsection Fl_Terminal_Caveats Caveats \par - This widget is not a full terminal emulator; it does not do stdio redirection, pseudo ttys/termios/character cooking, keyboard input processing, full curses(3) support. However, such features CAN be implemented with subclassing. \par - The printf() and vprintf() functions are limited to strings no longer than 1024 characters (including NULL). For printing longer strings, use append() which has no string limits. \par - For background colors textbgcolor() and textbgcolor_default(), the special color value 0xffffffff lets the widget's box() color() show through behind the text. **/ class FL_EXPORT Fl_Terminal : public Fl_Group { ////////////////////////////////////// ////// Fl_Terminal Public Enums ////// ////////////////////////////////////// public: /** \enum RedrawStyle Determines when Fl_Terminal calls redraw() if new text is added. RATE_LIMITED is the recommended setting, using redraw_rate(float) to determine the maximum rate of redraws. \see redraw_style(), redraw_rate() */ enum RedrawStyle { NO_REDRAW=0, ///< app must call redraw() as needed to update text to screen RATE_LIMITED, ///< timer controlled redraws. (DEFAULT) PER_WRITE ///< redraw triggered after *every* append() / printf() / etc. operation }; /** \enum Attrib Bits for the per-character attributes, which control text features such as italic, bold, underlined text, etc. NOTE: enum names with a leading underbar must not be used, and are reserved for future use. */ enum Attrib { NORMAL = 0x00, ///< all attributes off BOLD = 0x01, ///< bold text: uses bold font, color brighter than normal DIM = 0x02, ///< dim text; color slightly darker than normal ITALIC = 0x04, ///< italic font text UNDERLINE = 0x08, ///< underlined text _RESERVED_1 = 0x10, ///< (reserved for internal future use) INVERSE = 0x20, ///< inverse text; fg/bg color are swapped _RESERVED_2 = 0x40, ///< (reserved for internal future use) STRIKEOUT = 0x80 ///< strikeout text }; /** \enum CharFlags Per-character 8 bit flags (uchar) used to manage special states for characters. */ enum CharFlags { FG_XTERM = 0x01, ///< this char's fg color is an XTERM color; can be affected by Dim+Bold BG_XTERM = 0x02, ///< this char's bg color is an XTERM color; can be affected by Dim+Bold EOL = 0x04, ///< TODO: char at EOL, used for line re-wrap during screen resizing RESV_A = 0x08, RESV_B = 0x10, RESV_C = 0x20, RESV_D = 0x40, RESV_E = 0x80, COLORMASK = (FG_XTERM | BG_XTERM) }; /** \enum OutFlags Output translation flags for special control character translations. */ enum OutFlags { OFF = 0x00, ///< no output translation CR_TO_LF = 0x01, ///< carriage return generates a vertical line-feed (\\r -> \\n) LF_TO_CR = 0x02, ///< line-feed generates a carriage return (\\n -> \\r) LF_TO_CRLF = 0x04 ///< line-feed generates a carriage return line-feed (\\n -> \\r\\n) }; /** \enum ScrollbarStyle Behavior of scrollbars */ enum ScrollbarStyle { SCROLLBAR_OFF = 0x00, ///< scrollbar always invisible SCROLLBAR_AUTO = 0x01, ///< scrollbar visible if widget resized in a way that hides columns (default) SCROLLBAR_ON = 0x02 ///< scrollbar always visible }; /////////////////////////////////////////////////////////////// ////// ////// Fl_Terminal Protected Classes ////// /////////////////////////////////////////////////////////////// protected: // Margin Class //////////////////////////////////////////// // // Class to manage the terminal's margins // class FL_EXPORT Margin { int left_, right_, top_, bottom_; public: Margin(void) { left_ = right_ = top_ = bottom_ = 3; } int left(void) const { return left_; } int right(void) const { return right_; } int top(void) const { return top_; } int bottom(void) const { return bottom_; } void left(int val) { left_ = val; } void right(int val) { right_ = val; } void top(int val) { top_ = val; } void bottom(int val) { bottom_ = val; } }; // CharStyle Class //////////////////////////////////////////// // // Class to manage the terminal's character style // This includes the font, color, and some cached internal // info for optimized drawing speed. // class FL_EXPORT CharStyle { uchar attrib_; // bold, underline.. uchar charflags_; // CharFlags (xterm color management) Fl_Color fgcolor_; // foreground color for text Fl_Color bgcolor_; // background color for text Fl_Color defaultfgcolor_; // default fg color used by ESC[0m Fl_Color defaultbgcolor_; // default bg color used by ESC[0m Fl_Font fontface_; // font face Fl_Fontsize fontsize_; // font size int fontheight_; // font height (in pixels) int fontdescent_; // font descent (pixels below font baseline) int charwidth_; // width of a fixed width ASCII character public: CharStyle(bool fontsize_defer); uchar attrib(void) const { return attrib_; } uchar charflags(void) const { return charflags_; } // Colors - All access to colors are by Fl_Color only. // There are three ways to SET colors: Fl_Color, rgb, xterm(uchar) // Fl_Color fltk_fg_color(uchar ci); Fl_Color fltk_bg_color(uchar ci); Fl_Color fgcolor(void) const; Fl_Color bgcolor(void) const; Fl_Color defaultfgcolor(void) const { return defaultfgcolor_; } Fl_Color defaultbgcolor(void) const { return defaultbgcolor_; } Fl_Font fontface(void) const { return fontface_; } Fl_Fontsize fontsize(void) const { return fontsize_; } int fontheight(void) const { return fontheight_; } int fontdescent(void) const { return fontdescent_; } int charwidth(void) const { return charwidth_; } uchar colorbits_only(uchar inflags) const; void attrib(uchar val) { attrib_ = val; } void charflags(uchar val) { charflags_ = val; } void set_charflag(uchar val) { charflags_ |= val; } void clr_charflag(uchar val) { charflags_ &= ~val; } // Non-xterm colors void fgcolor(int r,int g,int b) { fgcolor_ = (r<<24) | (g<<16) | (b<<8); clr_charflag(FG_XTERM); } void bgcolor(int r,int g,int b) { bgcolor_ = (r<<24) | (g<<16) | (b<<8); clr_charflag(BG_XTERM); } void fgcolor(Fl_Color val) { fgcolor_ = val; clr_charflag(FG_XTERM); } void bgcolor(Fl_Color val) { bgcolor_ = val; clr_charflag(BG_XTERM); } // Xterm colors void fgcolor_xterm(Fl_Color val) { fgcolor_ = val; set_charflag(FG_XTERM); } void bgcolor_xterm(Fl_Color val) { bgcolor_ = val; set_charflag(BG_XTERM); } void fgcolor_xterm(uchar val); void bgcolor_xterm(uchar val); // void defaultfgcolor(Fl_Color val) { defaultfgcolor_ = val; } void defaultbgcolor(Fl_Color val) { defaultbgcolor_ = val; } void fontface(Fl_Font val) { fontface_ = val; update(); } void fontsize(Fl_Fontsize val) { fontsize_ = val; update(); } void update(void); void update_fake(void); // SGR MODES: Set Graphics Rendition void sgr_reset(void) { // e.g. ESC[0m attrib(Fl_Terminal::NORMAL); if (charflags() & FG_XTERM) fgcolor_xterm(defaultfgcolor_); else fgcolor(defaultfgcolor_); if (charflags() & BG_XTERM) bgcolor_xterm(defaultbgcolor_); else bgcolor(defaultbgcolor_); } int onoff(bool flag, Attrib a) { return (flag ? (attrib_ | a) : (attrib_ & ~a)); } void sgr_bold(bool val) { attrib_ = onoff(val, Fl_Terminal::BOLD); } // e.g. ESC[1m void sgr_dim(bool val) { attrib_ = onoff(val, Fl_Terminal::DIM); } // e.g. ESC[2m void sgr_italic(bool val) { attrib_ = onoff(val, Fl_Terminal::ITALIC); } // e.g. ESC[3m void sgr_underline(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[3m void sgr_dbl_under(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[21m (TODO!) void sgr_blink(bool val) { (void)val; /* NOT IMPLEMENTED */ } // e.g. ESC[5m void sgr_inverse(bool val) { attrib_ = onoff(val, Fl_Terminal::INVERSE); } // e.g. ESC[7m void sgr_strike(bool val) { attrib_ = onoff(val, Fl_Terminal::STRIKEOUT); } // e.g. ESC[9m }; protected: // Cursor Class /////////////////////////////////////////////////////////// // // Class to manage the terminal's cursor position, color, etc. // class FL_EXPORT Cursor { int col_; // cursor's current col (x) position on display int row_; // cursor's current row (y) position on display int h_; // cursor's height (affected by font size) Fl_Color fgcolor_; // cursor's fg color (color of text, if any) Fl_Color bgcolor_; // cursor's bg color public: Cursor(void) { col_ = 0; row_ = 0; h_ = 10; fgcolor_ = 0xfffff000; // wht bgcolor_ = 0x00d00000; // grn } int col(void) const { return col_; } int row(void) const { return row_; } int h(void) const { return h_; } Fl_Color fgcolor(void) const { return fgcolor_; } Fl_Color bgcolor(void) const { return bgcolor_; } void col(int val) { col_ = val >= 0 ? val : 0; } void row(int val) { row_ = val >= 0 ? val : 0; } void h(int val) { h_ = val; } void fgcolor(Fl_Color val) { fgcolor_ = val; } void bgcolor(Fl_Color val) { bgcolor_ = val; } int left(void) { col_ = (col_>0) ? (col_-1) : 0; return col_; } int right(void) { return ++col_; } int up(void) { row_ = (row_>0) ? (row_-1) : 0; return row_; } int down(void) { return ++row_; } bool is_rowcol(int drow,int dcol) const; void scroll(int nrows); void home(void) { row_ = 0; col_ = 0; } }; // Utf8Char Class /////////////////////////////////////////////////////////// // // Class to manage the terminal's individual UTF-8 characters. // Includes fg/bg color, attributes (BOLD, UNDERLINE..) // class FL_EXPORT Utf8Char { static const int max_utf8_ = 4; // RFC 3629 paraphrased: In UTF-8, chars are encoded with 1 to 4 octets char text_[max_utf8_]; // memory for actual ASCII or UTF-8 byte contents uchar len_; // length of bytes in text_[] buffer; 1 for ASCII, >1 for UTF-8 uchar attrib_; // attribute bits for this char (bold, underline..) uchar charflags_; // CharFlags (xterm colors management) Fl_Color fgcolor_; // fltk fg color (supports 8color or 24bit color set w/ESC[37;;;m) Fl_Color bgcolor_; // fltk bg color (supports 8color or 24bit color set w/ESC[47;;;m) // Private methods void text_utf8_(const char *text, int len); Fl_Color attr_color_(Fl_Color col, const Fl_Widget *grp) const; public: // Public methods Utf8Char(void); // ctor Utf8Char(const Utf8Char& o); // copy ctor ~Utf8Char(void); // dtor Utf8Char& operator=(const Utf8Char& o); // assignment inline int max_utf8() const { return max_utf8_; } void text_utf8(const char *text, int len, const CharStyle& style); void text_ascii(char c, const CharStyle& style); void fl_font_set(const CharStyle& style) const; // Return the UTF-8 text string for this character. // Use length() to get number of bytes in string, which will be 1 for ASCII chars. // const char* text_utf8(void) const { return text_; } // Return the attribute for this char uchar attrib(void) const { return attrib_; } uchar charflags(void) const { return charflags_; } Fl_Color fgcolor(void) const; Fl_Color bgcolor(void) const; // Return the length of this character in bytes (UTF-8 can be multibyte..) int length(void) const { return int(len_); } double pwidth(void) const; int pwidth_int(void) const; // Clear the character to a 'space' void clear(const CharStyle& style) { text_utf8(" ", 1, style); charflags_ = 0; attrib_ = 0; } bool is_char(char c) const { return *text_ == c; } void show_char(void) const { ::printf("%.*s", len_, text_); } void show_char_info(void) const { ::fprintf(stderr, "UTF-8('%.*s', len=%d)\n", len_, text_, len_); } Fl_Color attr_fg_color(const Fl_Widget *grp) const; Fl_Color attr_bg_color(const Fl_Widget *grp) const; }; // RingBuffer Class /////////////////////////////////////////////////// // // Manages ring with indexed row/col and "history" vs. "display" concepts. // class FL_EXPORT RingBuffer { Utf8Char *ring_chars_; // the ring UTF-8 char buffer int ring_rows_; // #rows in ring total int ring_cols_; // #columns in ring/hist/disp int nchars_; // #chars in ring (ring_rows*ring_cols) int hist_rows_; // #rows in history int hist_use_; // #rows in use by history int disp_rows_; // #rows in display int offset_; // index offset (used for 'scrolling') private: void new_copy(int drows, int dcols, int hrows, const CharStyle& style); //DEBUG void write_row(FILE *fp, Utf8Char *u8c, int cols) const { //DEBUG cols = (cols != 0) ? cols : ring_cols(); //DEBUG for ( int col=0; collength(), u8c->text_utf8()); //DEBUG } //DEBUG } public: void clear(void); void clear_hist(void); RingBuffer(void); RingBuffer(int drows, int dcols, int hrows); ~RingBuffer(void); // Methods to access ring // // The 'offset' concept allows the 'history' and 'display' // to be scrolled indefinitely. The 'offset' is applied // to all the row accesses, and are clamped to within their bounds. // // For 'raw' access to the ring (without the offset concept), // use the ring_chars() method, and walk from 0 - ring_rows(). // // _____________ // | | <- hist_srow() <- ring_srow() // | H i s t | // | | // |_____________| <- hist_erow() // | | <- disp_srow() // | D i s p | // | | // |_____________| <- disp_erow() <- ring_erow() // // \___________/ // ring_cols() // hist_cols() // disp_cols() // inline int ring_rows(void) const { return ring_rows_; } inline int ring_cols(void) const { return ring_cols_; } inline int ring_srow(void) const { return(0); } inline int ring_erow(void) const { return(ring_rows_ - 1); } inline int hist_rows(void) const { return hist_rows_; } inline int hist_cols(void) const { return ring_cols_; } inline int hist_srow(void) const { return((offset_ + 0) % ring_rows_); } inline int hist_erow(void) const { return((offset_ + hist_rows_ - 1) % ring_rows_); } inline int disp_rows(void) const { return disp_rows_; } inline int disp_cols(void) const { return ring_cols_; } inline int disp_srow(void) const { return((offset_ + hist_rows_) % ring_rows_); } inline int disp_erow(void) const { return((offset_ + hist_rows_ + disp_rows_ - 1) % ring_rows_); } inline int offset(void) const { return offset_; } void offset_adjust(int rows); void hist_rows(int val) { hist_rows_ = val; } void disp_rows(int val) { disp_rows_ = val; } // History use inline int hist_use(void) const { return hist_use_; } inline void hist_use(int val) { hist_use_ = val; } inline int hist_use_srow(void) const { return((offset_ + hist_rows_ - hist_use_) % ring_rows_); } inline Utf8Char *ring_chars(void) { return ring_chars_; } // access ring buffer directly inline Utf8Char *ring_chars(void) const { return ring_chars_; } // access ring buffer directly bool is_hist_ring_row(int grow) const; bool is_disp_ring_row(int grow) const; //DEBUG void show_ring_info(void) const; void move_disp_row(int src_row, int dst_row); void clear_disp_rows(int sdrow, int edrow, const CharStyle& style); void scroll(int rows, const CharStyle& style); const Utf8Char* u8c_ring_row(int row) const; const Utf8Char* u8c_hist_row(int hrow) const; const Utf8Char* u8c_hist_use_row(int hurow) const; const Utf8Char* u8c_disp_row(int drow) const; // Non-const versions of the above methods // Using "Effective C++" ugly-as-hell syntax technique. // Utf8Char* u8c_ring_row(int row); Utf8Char* u8c_hist_row(int hrow); Utf8Char* u8c_hist_use_row(int hurow); Utf8Char* u8c_disp_row(int drow); void create(int drows, int dcols, int hrows); void resize(int drows, int dcols, int hrows, const CharStyle& style); void change_disp_rows(int drows, const CharStyle& style); void change_disp_cols(int dcols, const CharStyle& style); }; // Selection Class /////////////////////////////////////////////////// // // Class to manage mouse selection // class FL_EXPORT Selection { Fl_Terminal *terminal_; int srow_, scol_, erow_, ecol_; // selection start/end. NOTE: start *might* be > end int push_row_, push_col_; // global row/col for last FL_PUSH bool push_char_right_; Fl_Color selectionbgcolor_; Fl_Color selectionfgcolor_; int state_ ; // 0=none, 1=started, 2=extended, 3=done bool is_selection_; // false: no selection public: Selection(Fl_Terminal *terminal); int srow(void) const { return srow_; } int scol(void) const { return scol_; } int erow(void) const { return erow_; } int ecol(void) const { return ecol_; } void push_clear() { push_row_ = push_col_ = -1; push_char_right_ = false; } void push_rowcol(int row,int col,bool char_right) { push_row_ = row; push_col_ = col; push_char_right_ = char_right; } void start_push() { start(push_row_, push_col_, push_char_right_); } bool dragged_off(int row,int col,bool char_right) { return (push_row_ != row) || (push_col_+push_char_right_ != col+char_right); } void selectionfgcolor(Fl_Color val) { selectionfgcolor_ = val; } void selectionbgcolor(Fl_Color val) { selectionbgcolor_ = val; } Fl_Color selectionfgcolor(void) const { return selectionfgcolor_; } Fl_Color selectionbgcolor(void) const { return selectionbgcolor_; } bool is_selection(void) const { return is_selection_; } bool get_selection(int &srow,int &scol,int &erow,int &ecol) const; // guarantees return (start < end) bool start(int row, int col, bool char_right); bool extend(int row, int col, bool char_right); void end(void); void select(int srow, int scol, int erow, int ecol); bool clear(void); int state(void) const { return state_; } void scroll(int nrows); }; // EscapeSeq Class /////////////////////////////////////////////////// // // Class to handle parsing ESC sequences // // Holds all state information for parsing esc sequences, // so sequences can span multiple block read(2) operations, etc. // Handling of parsed sequences is NOT handled in this class, // just the parsing of the sequences and managing generic integers. // class FL_EXPORT EscapeSeq { public: // EscapeSeq Constants // Maximums static const int maxbuff = 80; // character buffer static const int maxvals = 20; // integer value buffer // Return codes static const int success = 0; // operation succeeded static const int fail = -1; // operation failed static const int completed = 1; // multi-step operation completed successfully private: char esc_mode_; // escape parsing mode state char csi_; // This is an ESC[.. sequence (Ctrl Seq Introducer) char buff_[maxbuff]; // escape sequence being parsed char *buffp_; // parsing ptr into buff[] char *buffendp_; // end of buff[] (ptr to last valid buff char) char *valbuffp_; // pointer to first char in buff of integer being parsed int vals_[maxvals]; // value array for parsing #'s in ESC[#;#;#.. int vali_; // parsing index into vals_[], 0 if none int save_row_, save_col_; // used by ESC[s/u for save/restore int append_buff(char c); int append_val(void); public: EscapeSeq(void); void reset(void); char esc_mode(void) const; void esc_mode(char val); int total_vals(void) const; int val(int i) const; int defvalmax(int dval, int max) const; bool parse_in_progress(void) const; bool is_csi(void) const; int parse(char c); void save_cursor(int row, int col); void restore_cursor(int &row, int &col); }; // Partial UTF-8 Buffer Class //////////////////////////////////////////// // // Class to manage buffering partial UTF-8 characters between write calls. // class FL_EXPORT PartialUtf8Buf { char buf_[10]; // buffer partial UTF-8 encoded char int buflen_; // length of buffered UTF-8 encoded char int clen_; // final byte length of a UTF-8 char public: void clear(void) { buflen_ = clen_ = 0; } // clear the buffer PartialUtf8Buf(void) { clear(); } // Ctor // Is byte 'c' in the middle of a UTF-8 encoded byte sequence? bool is_continuation(char c) { // Byte 1 Byte 2 Byte 3 ..etc.. // ASCII: 0xxxxxxx // UTF8(2): 110xxxxx 10xxxxxx // UTF8(3): 1110xxxx 10xxxxxx 10xxxxxx // UTF8(4): 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx // UTF8(5): 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx // UTF8(6): 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx // \______/ \______________________________________________/ // Start byte Continuation bytes // (c & 0xc0) == 0x80 return ((c & 0xc0) == 0x80); } // Access buffer const char* buf(void) const { return buf_; } // Access buffer length int buflen(void) const { return buflen_; } // Append bytes of a partial UTF-8 string to the buffer. // // Returns: // - true if done OK. Use is_complete() to see if a complete char received. // - false if buffer overrun occurred, class is clear()ed. // // An appropriate response to 'false' would be to print the // "unknown character" and skip all subsequent UTF-8 continuation chars. // bool append(const char* p, int len) { if (len <= 0) return true; // ignore silly requests: say we did but dont if (buflen_ + len >= (int)sizeof(buf_)) // overrun check { clear(); return false; } // clear self, return false if (!buflen_) clen_ = fl_utf8len(*p); // first byte? save char len for later while (len>0) { buf_[buflen_++] = *p++; len--; } // append byte to buffer return true; } bool is_complete(void) const { return (buflen_ && (buflen_ == clen_)); } }; /////////////////////////////////////////////////////////////// ////// ////// Fl_Terminal members + methods ////// /////////////////////////////////////////////////////////////// public: /** Vertical scrollbar. This is public so it can be accessed directly, e.g. - \ref Fl_Scrollbar::value(void) "scrollbar->value(void)" returns the row offset from the bottom of the display, 0 being the bottom (default). - \ref Fl_Scrollbar::value(int) "scrollbar->value(int)" similarly sets the row offset, which should be in the range [0 .. Fl_Scrollbar::maximum()]. - \ref Fl_Scrollbar::step(double) "scrollbar->step(double)" sets the smoothness of scrolling, default is 0.25 for 4 steps of motion per column. \todo Support scrollbar_left/right() - See Fl_Browser_::scrollbar docs \todo Support new ScrollbarStyle */ Fl_Scrollbar *scrollbar; // vertical scrollbar (value: rows above disp_chars[]) /** Horizontal scrollbar. This is public so it can be accessed directly, e.g. - \ref Fl_Scrollbar::value(void) "hscrollbar->value(void)" returns the column offset position from the left edge of the display; 0 being the left edge (default). - \ref Fl_Scrollbar::value(int) "hscrollbar->value(int)" similarly sets the column offset, which should be in the range [0 .. Fl_Scrollbar::maximum()]. - \ref Fl_Scrollbar::step(double) "hscrollbar->step(double)" sets the smoothness of scrolling, default is 0.25 for 4 steps of motion per column. */ Fl_Scrollbar *hscrollbar; // horizontal scrollbar private: // Special utf8 symbols const char *error_char_; // utf8 string shown for invalid utf8, bad ANSI, etc bool fontsize_defer_; // flag defers font calcs until first draw() (issue 837) int scrollbar_size_; // local preference for scrollbar size ScrollbarStyle hscrollbar_style_; CharStyle *current_style_; // current font, attrib, color.. OutFlags oflags_; // output translation flags (CR_TO_LF, LF_TO_CR, LF_TO_CRLF) // A ring buffer is used for the terminal's history (hist) and display (disp) buffer. // See README-Fl_Terminal.txt, section "RING BUFFER DESCRIPTION" for diagrams/info. // // Ring buffer RingBuffer ring_; // terminal history/display ring buffer Cursor cursor_; // terminal cursor (position, color, etc) Margin margin_; // terminal margins (top,left,bottom,right) Selection select_; // mouse selection EscapeSeq escseq; // Escape sequence parsing (ESC[ xterm/vt100) bool show_unknown_; // if true, show unknown chars as '¿' (default off) bool ansi_; // if true, parse ansi codes (default on) char *tabstops_; // array of tab stops (0|1) \__ TODO: This should probably int tabstops_size_; // size of tabstops[] array / be a class "TabStops". Fl_Rect scrn_; // terminal screen xywh inside box(), margins, and scrollbar int autoscroll_dir_; // 0=autoscroll timer off, 3=scrolling up, 4=scrolling down int autoscroll_amt_; // #pixels above or below edge, used for autoscroll speed RedrawStyle redraw_style_; // NO_REDRAW, RATE_LIMITED, PER_WRITE float redraw_rate_; // maximum redraw rate in seconds, default=0.10 bool redraw_modified_; // display modified; used by update_cb() to rate limit redraws bool redraw_timer_; // if true, redraw timer is running PartialUtf8Buf pub_; // handles Partial Utf8 Buffer (pub) protected: // Ring buffer management const Utf8Char* u8c_ring_row(int grow) const; const Utf8Char* u8c_hist_row(int hrow) const; const Utf8Char* u8c_hist_use_row(int hrow) const; const Utf8Char* u8c_disp_row(int drow) const; // Non-const versions of the above. // "Effective C++" says: implement non-const method to cast away const // Utf8Char* u8c_ring_row(int grow); Utf8Char* u8c_hist_row(int hrow); Utf8Char* u8c_hist_use_row(int hurow); Utf8Char* u8c_disp_row(int drow); Utf8Char* u8c_cursor(void); private: void create_ring(int drows, int dcols, int hrows); void init_(int X,int Y,int W,int H,const char*L,int rows,int cols,int hist,bool fontsize_defer); // Tabstops void init_tabstops(int newsize); void default_tabstops(void); void clear_all_tabstops(void); void set_tabstop(void); void clear_tabstop(void); // Updates void update_screen_xywh(void); void update_screen(bool font_changed); void set_scrollbar_params(Fl_Scrollbar* scroll, int min, int max); void update_scrollbar(void); // Resize void resize_display_rows(int drows); void resize_display_columns(int dcols); void refit_disp_to_screen(void); // Callbacks static void scrollbar_cb(Fl_Widget*, void*); // scrollbar manipulation static void autoscroll_timer_cb(void*); // mouse drag autoscroll void autoscroll_timer_cb2(void); static void redraw_timer_cb(void*); // redraw rate limiting timer void redraw_timer_cb2(void); // Screen management protected: CharStyle& current_style(void) const; void current_style(const CharStyle& sty); private: int x_to_glob_col(int X, int grow, int &gcol, bool &gcr) const; int xy_to_glob_rowcol(int X, int Y, int &grow, int &gcol, bool &gcr) const; protected: int w_to_col(int W) const; int h_to_row(int H) const; // API: Display clear operations void clear_sod(void); void clear_eod(void); void clear_eol(void); void clear_sol(void); void clear_line(int row); void clear_line(void); const Utf8Char* walk_selection(const Utf8Char *u8c, int &row, int &col) const; bool get_selection(int &srow,int &scol,int &erow,int &ecol) const; bool is_selection(void) const; bool is_inside_selection(int row,int col) const; private: bool is_hist_ring_row(int grow) const; bool is_disp_ring_row(int grow) const; public: int selection_text_len(void) const; const char* selection_text(void) const; protected: void clear_mouse_selection(void); bool selection_extend(int X,int Y); void select_word(int grow, int gcol); void select_line(int grow); void scroll(int rows); void insert_rows(int count); void delete_rows(int count); void insert_char_eol(char c, int drow, int dcol, int rep); void insert_char(char c, int rep); void delete_chars(int drow, int dcol, int rep); void delete_chars(int rep); public: // API: Terminal operations void clear(void); void clear(Fl_Color val); void clear_screen(bool scroll_to_hist=true); // ESC [ 2 J void clear_screen_home(bool scroll_to_hist=true); // ESC [ H ESC [ 2 J void clear_history(void); // ESC [ 3 J void reset_terminal(void); // ESC c void cursor_home(void); // ESC [ 0 H // API: Cursor void cursorfgcolor(Fl_Color val); void cursorbgcolor(Fl_Color val); Fl_Color cursorfgcolor(void) const; Fl_Color cursorbgcolor(void) const; protected: void cursor_row(int row); void cursor_col(int col); public: int cursor_row(void) const; int cursor_col(void) const; protected: void cursor_up(int count=1, bool do_scroll=false); void cursor_down(int count=1, bool do_scroll=false); void cursor_left(int count=1); void cursor_right(int count=1, bool do_scroll=false); void cursor_eol(void); void cursor_sol(void); void cursor_cr(void); void cursor_crlf(int count=1); void cursor_tab_right(int count=1); void cursor_tab_left(int count=1); void save_cursor(void); void restore_cursor(void); // Output translation public: void output_translate(Fl_Terminal::OutFlags val); Fl_Terminal::OutFlags output_translate(void) const; private: void handle_lf(void); void handle_cr(void); void handle_esc(void); // Printing void handle_ctrl(char c); bool is_printable(char c); bool is_ctrl(char c); void handle_SGR(void); void handle_DECRARA(void); void handle_escseq(char c); // -- void display_modified(void); void display_modified_clear(void); void clear_char_at_disp(int drow, int dcol); const Utf8Char* utf8_char_at_disp(int drow, int dcol) const; const Utf8Char* utf8_char_at_glob(int grow, int gcol) const; void repeat_char(char c, int rep); void utf8_cache_clear(void); void utf8_cache_flush(void); // API: Character display output public: void plot_char(const char *text, int len, int drow, int dcol); void plot_char(char c, int drow, int dcol); void print_char(const char *text, int len=-1); void print_char(char c); // API: String display output void append_utf8(const char *buf, int len=-1); void append_ascii(const char *s); void append(const char *s, int len=-1); protected: int handle_unknown_char(void); int handle_unknown_char(int drow, int dcol); // Drawing void draw_row_bg(int grow, int X, int Y) const; void draw_row(int grow, int Y) const; void draw_buff(int Y) const; private: void handle_selection_autoscroll(void); int handle_selection(int e); public: // FLTK: draw(), resize(), handle() void draw(void) FL_OVERRIDE; void resize(int X,int Y,int W,int H) FL_OVERRIDE; int handle(int e) FL_OVERRIDE; const char* text(bool lines_below_cursor=false) const; protected: // Internal short names // Don't make these public, but allow internals and // derived classes to maintain brevity. // /// Return the number of rows in the ring buffer. inline int ring_rows(void) const { return ring_.ring_rows(); } /// Return the number of columns in the ring buffer. inline int ring_cols(void) const { return ring_.ring_cols(); } /// Return the starting row# in the ring buffer. (Always 0) inline int ring_srow(void) const { return ring_.ring_srow(); } /// Return the ending row# in the ring buffer (Always ring_rows()-1) inline int ring_erow(void) const { return ring_.ring_erow(); } /// Return the number of rows in the scrollback history. inline int hist_rows(void) const { return ring_.hist_rows(); } /// Return the number of columns in the scrollback history. inline int hist_cols(void) const { return ring_.hist_cols(); } /// Return the starting row# of the scrollback history. inline int hist_srow(void) const { return ring_.hist_srow(); } /// Return the ending row# of the scrollback history. inline int hist_erow(void) const { return ring_.hist_erow(); } /// Return number of rows in use by the scrollback history. inline int hist_use(void) const { return ring_.hist_use(); } /// Return the starting row of the "in use" scrollback history. inline int hist_use_srow(void) const { return ring_.hist_use_srow(); } /// Return the number of rows in the display area. inline int disp_rows(void) const { return ring_.disp_rows(); } /// Return the number of columns in the display area. inline int disp_cols(void) const { return ring_.disp_cols(); } /// Return the starting row# in the display area. inline int disp_srow(void) const { return ring_.disp_srow(); } /// Return the ending row# in the display area. inline int disp_erow(void) const { return ring_.disp_erow(); } /// Returns the current offset into the ring buffer. inline int offset(void) const { return ring_.offset(); } // TODO: CLEAN UP WHAT'S PUBLIC, AND WHAT SHOULD BE 'PROTECTED' AND 'PRIVATE' // Some of the public stuff should, quite simply, "not be". // API: Terminal features public: // API: Scrollbar int scrollbar_size(void) const; void scrollbar_size(int val); int scrollbar_actual_size(void) const; void hscrollbar_style(ScrollbarStyle val); ScrollbarStyle hscrollbar_style(void) const; // API: History int history_rows(void) const; void history_rows(int val); int history_use(void) const; // API: Display int display_rows(void) const; void display_rows(int val); int display_columns(void) const; void display_columns(int val); // API: Box /// Sets the box type, updates terminal margins et al. Default is FL_DOWN_FRAME. /// /// FL_XXX_FRAME types are handled in a special way by this widget, and guarantee /// the background is a flat field. /// /// FL_XXX_BOX may draw gradients as inherited by Fl::scheme(). /// void box(Fl_Boxtype val) { Fl_Group::box(val); update_screen(false); } /// Returns the current box type. Fl_Boxtype box(void) const { return Fl_Group::box(); } // API: Margins /// Return the left margin; see \ref Fl_Terminal_Margins. int margin_left(void) const { return margin_.left(); } /// Return the right margin; see \ref Fl_Terminal_Margins. int margin_right(void) const { return margin_.right(); } /// Return the top margin; see \ref Fl_Terminal_Margins. int margin_top(void) const { return margin_.top(); } /// Return the bottom margin; see \ref Fl_Terminal_Margins. int margin_bottom(void) const { return margin_.bottom(); } void margin_left(int val); void margin_right(int val); void margin_top(int val); void margin_bottom(int val); // API: Text font/size/color void textfont(Fl_Font val); void textsize(Fl_Fontsize val); void textcolor(Fl_Color val); void color(Fl_Color val); void textfgcolor(Fl_Color val); void textbgcolor(Fl_Color val); void textfgcolor_default(Fl_Color val); void textbgcolor_default(Fl_Color val); /// Return text font used to draw all text in the terminal. Fl_Font textfont(void) const { return current_style_->fontface(); } /// Return text font size used to draw all text in the terminal. Fl_Fontsize textsize(void) const { return current_style_->fontsize(); } /// Return base widget Fl_Group's box() color() Fl_Color color(void) const { return Fl_Group::color(); } /// Return textcolor(). This is a convenience method that returns textfgcolor_default() Fl_Color textcolor(void) const { return textfgcolor_default(); } /// Return text's current foreground color. Fl_Color textfgcolor(void) const { return current_style_->fgcolor(); } /// Return text's current background color. Fl_Color textbgcolor(void) const { return current_style_->bgcolor(); } /// Return text's default foreground color. \see textfgcolor() Fl_Color textfgcolor_default(void) const { return current_style_->defaultfgcolor(); } /// Return text's default background color. \see textbgcolor() Fl_Color textbgcolor_default(void) const { return current_style_->defaultbgcolor(); } void textfgcolor_xterm(uchar val); void textbgcolor_xterm(uchar val); /// Set mouse selection foreground color. void selectionfgcolor(Fl_Color val) { select_.selectionfgcolor(val); } /// Set mouse selection background color. void selectionbgcolor(Fl_Color val) { select_.selectionbgcolor(val); } /// Get mouse selection foreground color. Fl_Color selectionfgcolor(void) const { return select_.selectionfgcolor(); } /// Get mouse selection background color. Fl_Color selectionbgcolor(void) const { return select_.selectionbgcolor(); } // API: Text attrib void textattrib(uchar val); uchar textattrib() const; // API: Redraw style/rate RedrawStyle redraw_style(void) const; void redraw_style(RedrawStyle val); private: bool is_redraw_style(RedrawStyle val) { return redraw_style_ == val; } public: float redraw_rate(void) const; void redraw_rate(float val); // API: Show unknown/invalid utf8/ANSI sequences with an error character (¿). bool show_unknown(void) const; void show_unknown(bool val); /// Sets the "error character" utf8 string shown for invalid utf8 /// or bad ANSI sequences if show_unknown() is true. Default: "¿". /// \see show_unknown(bool) void error_char(const char* val) { error_char_ = val; } /// Returns the "error character" utf8 string, which is shown for invalid utf8 /// or bad ANSI sequences if show_unknown() is true. \see show_unknown(bool) const char* error_char(void) const { return error_char_; } // API: ANSI sequences bool ansi(void) const; void ansi(bool val); // Fl_Simple_Terminal API compatibility int history_lines(void) const; void history_lines(int val); // API: printf() void printf(const char *fmt, ...); void vprintf(const char *fmt, va_list ap); // Ctor Fl_Terminal(int X,int Y,int W,int H,const char*L=0); Fl_Terminal(int X,int Y,int W,int H,const char*L,int rows,int cols,int hist); // Dtor ~Fl_Terminal(void); // Debugging features //DEBUG void show_ring_info() const { ring_.show_ring_info(); } //DEBUG void write_row(FILE *fp, Utf8Char *u8c, int cols) const; //DEBUG void show_buffers(RingBuffer *a, RingBuffer *b=0) const; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Text_Buffer.H ================================================ // // Header file for Fl_Text_Buffer class. // // Copyright 2001-2023 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under // the LGPL for the FLTK library granted by Mark Edel. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Text_Buffer, Fl_Text_Selection widget . */ #ifndef FL_TEXT_BUFFER_H #define FL_TEXT_BUFFER_H #include /* va_list */ #include "fl_attr.h" /* Doxygen can't find */ #undef ASSERT_UTF8 #ifdef ASSERT_UTF8 # include # define IS_UTF8_ALIGNED(a) if (a && *a) assert(fl_utf8len(*(a))>0); # define IS_UTF8_ALIGNED2(a, b) if (b>=0 && blength()) assert(fl_utf8len(a->byte_at(b))>0); #else # define IS_UTF8_ALIGNED(a) # define IS_UTF8_ALIGNED2(a, b) #endif /* "character size" is the size of a UTF-8 character in bytes "character width" is the width of a Unicode character in pixels "column" was originally defined as a character offset from the left margin. It was identical to the byte offset. In UTF-8, we have neither a byte offset nor truly fixed width fonts (*). Column could be a pixel value multiplied with an average character width (which is a bearable approximation). * in Unicode, there are no fixed width fonts! Even if the ASCII characters may happen to be all the same width in pixels, Chinese characters surely are not. There are plenty of exceptions, like ligatures, that make special handling of "fixed" character widths a nightmare. I decided to remove all references to fixed fonts and see "columns" as a multiple of the average width of a character in the main font. - Matthias */ /* Maximum length in characters of a tab or control character expansion of a single buffer character */ #define FL_TEXT_MAX_EXP_CHAR_LEN 20 #include "Fl_Export.H" class Fl_Text_Undo_Action_List; class Fl_Text_Undo_Action; /** \class Fl_Text_Selection \brief This is an internal class for Fl_Text_Buffer to manage text selections. All methods use byte (not UTF-8 character) offsets and start at 0. This class works correctly with UTF-8 strings assuming that the parameters for all calls are on character boundaries. If the selection is inactive (not currently used), then selected() returns \p false and start() and end() return 0 (zero). The stored offsets are in ascending order, hence the following conditions are true (pseudo code): \code if ( !selected() ) : (start() == 0) && (end() == 0) && (start() == end()) if ( selected() ) : start() < end() always : 0 <= start() <= end() always : length() == end() - start() \endcode The selection size in bytes can always (unconditionally) be computed by \code int size = sel->end() - sel->start(); \endcode \see length() \note The \b protected member variables \p mStart and \p mEnd are not necessarily 0 (zero) if mSelected == \p false because they are not cleared when \p selected(false) is called (as of Jul 2017). This may be changed in the future. */ class FL_EXPORT Fl_Text_Selection { friend class Fl_Text_Buffer; public: // Sets the selection range and selected(). void set(int startpos, int endpos); // Updates a selection after text was modified. void update(int pos, int nDeleted, int nInserted); /** \brief Returns the byte offset to the first selected character. The returned offset is only valid if selected() returns true. If the selection is not valid the returned offset is 0 since FLTK 1.4.0. \note In FLTK 1.3.x the returned offset could be non-zero even if selected() would have returned 0. \return byte offset or 0 if not selected. */ int start() const { return mSelected ? mStart : 0; } /** \brief Returns the byte offset to the character after the last selected character. The returned offset is only valid if selected() returns true (non-zero). The offset is 0 if no text is selected (since FLTK 1.4.0). \note In FLTK 1.3.x the returned offset could be non-zero even if selected() would have returned 0. \return byte offset or 0 if not selected. */ int end() const { return mSelected ? mEnd : 0; } /** \brief Returns true if any text is selected. \return \p true if any text has been selected, or \p false if no text is selected. */ bool selected() const { return mSelected; } /** \brief Modifies the 'selected' flag. \param b new flag */ void selected(bool b) { mSelected = b; } /** \brief Returns the size in bytes of the selection. This is a convenience method. It always returns the same as \code end() - start() \endcode and it returns 0 if selected() == false. \return size in bytes or 0 if not selected. \since FLTK 1.4.0 */ int length() const { return mSelected ? mEnd - mStart : 0; } // Returns true if position \p pos is in this Fl_Text_Selection. int includes(int pos) const; // Returns true if selected() and the positions of this selection. int selected(int *startpos, int *endpos) const; FL_DEPRECATED("since 1.4.0 - use selected(startpos, endpos) instead", int position(int *startpos, int *endpos) const) { return selected(startpos, endpos); } protected: int mStart; ///< byte offset to the first selected character int mEnd; ///< byte offset to the character after the last selected character bool mSelected; ///< this flag is set if any text is selected }; typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted, int nRestyled, const char* deletedText, void* cbArg); typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg); /** This class manages Unicode text displayed in one or more Fl_Text_Display widgets. All text in Fl_Text_Buffer must be encoded in UTF-8. All indices used in the function calls must be aligned to the start of a UTF-8 sequence. All indices and pointers returned will be aligned. All functions that return a single character will return that in an unsigned int in UCS-4 encoding. The Fl_Text_Buffer class is used by the Fl_Text_Display and Fl_Text_Editor to manage complex text data and is based upon the excellent NEdit text editor engine - see https://sourceforge.net/projects/nedit/. */ class FL_EXPORT Fl_Text_Buffer { public: /** Create an empty text buffer of a pre-determined size. \param requestedSize use this to avoid unnecessary re-allocation if you know exactly how much the buffer will need to hold \param preferredGapSize Initial size for the buffer gap (empty space in the buffer where text might be inserted if the user is typing sequential characters) */ Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024); /** Frees a text buffer */ ~Fl_Text_Buffer(); /** \brief Returns the number of bytes in the buffer. \return size of text in bytes */ int length() const { return mLength; } /** \brief Get a copy of the entire contents of the text buffer. Memory is allocated to contain the returned string, which the caller must free. \return newly allocated text buffer - must be free'd, text is UTF-8 */ char* text() const; /** Replaces the entire contents of the text buffer. \param text Text must be valid UTF-8. If null, an empty string is substituted. */ void text(const char* text); /** \brief Get a copy of a part of the text buffer. Return a copy of the text between \p start and \p end character positions from text buffer \p buf. Positions start at 0, and the range does not include the character pointed to by \p end. When you are done with the text, free it using the free() function. \param start byte offset to first character \param end byte offset after last character in range \return newly allocated text buffer - must be free'd, text is UTF-8 */ char* text_range(int start, int end) const; /** Returns the character at the specified position \p pos in the buffer. Positions start at 0. \param pos byte offset into buffer, \p pos must be at a UTF-8 character boundary \return Unicode UCS-4 encoded character */ unsigned int char_at(int pos) const; /** Returns the raw byte at the specified position pos in the buffer. Positions start at 0. \param pos byte offset into buffer \return unencoded raw byte */ char byte_at(int pos) const; /** Convert a byte offset in buffer into a memory address. \param pos byte offset into buffer \return byte offset converted to a memory address */ const char *address(int pos) const { return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; } /** Convert a byte offset in buffer into a memory address. \param pos byte offset into buffer \return byte offset converted to a memory address */ char *address(int pos) { return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; } /** Inserts null-terminated string \p text at position \p pos. \param pos insertion position as byte offset (must be UTF-8 character aligned) \param text UTF-8 encoded text \param insertedLength number of bytes to insert, or -1 to indicate \p text is null-terminated */ void insert(int pos, const char* text, int insertedLength = -1); /** Appends the text string to the end of the buffer. \param t UTF-8 encoded text \param addedLength number of bytes to append, or -1 to indicate \p t is null-terminated */ void append(const char* t, int addedLength = -1) { insert(length(), t, addedLength); } void vprintf(const char *fmt, va_list ap); void printf(const char* fmt, ...); /** Deletes a range of characters in the buffer. \param start byte offset to first character to be removed \param end byte offset to character after last character to be removed */ void remove(int start, int end); /** Deletes the characters between \p start and \p end, and inserts the null-terminated string \p text in their place in the buffer. \param start byte offset to first character to be removed and new insert position \param end byte offset to character after last character to be removed \param text UTF-8 encoded text \param insertedLength number of bytes to insert, or -1 to indicate \p text is null-terminated */ void replace(int start, int end, const char *text, int insertedLength = -1); /** Copies text from another Fl_Text_Buffer to this one. \param fromBuf source text buffer, may be the same as this \param fromStart byte offset into buffer \param fromEnd byte offset into buffer \param toPos destination byte offset into buffer */ void copy(Fl_Text_Buffer* fromBuf, int fromStart, int fromEnd, int toPos); /** Undo text modification according to the undo variables or insert text from the undo buffer */ int undo(int *cp=0); /** Check if undo is enabled and if the last action can be undone. \see canUndo() */ bool can_undo() const; /** Redo previous undo action. */ int redo(int *cp=0); /** Check if undo is enabled and if the last undo action can be redone. \see canUndo() */ bool can_redo() const; /** Enable or disable undo actions for this text buffer. Undo actions are enable for text buffer by default. If used as a style buffer in Fl_Text_Display, undo actions are disabled as they are handled by the text buffer. \see can_undo() */ void canUndo(char flag=1); /** Inserts a file at the specified position. Returns - 0 on success - non-zero on error (strerror() contains reason) - 1 indicates open for read failed (no data loaded) - 2 indicates error occurred while reading data (data was partially loaded) File can be UTF-8 or CP1252 encoded. If the input file is not UTF-8 encoded, the Fl_Text_Buffer widget will contain data transcoded to UTF-8. By default, the message Fl_Text_Buffer::file_encoding_warning_message will warn the user about this. \see input_file_was_transcoded and transcoding_warning_action. */ int insertfile(const char *file, int pos, int buflen = 128*1024); /** Appends the named file to the end of the buffer. See also insertfile(). */ int appendfile(const char *file, int buflen = 128*1024) { return insertfile(file, length(), buflen); } /** Loads a text file into the buffer. See also insertfile(). */ int loadfile(const char *file, int buflen = 128*1024) { select(0, length()); remove_selection(); return appendfile(file, buflen); } /** Writes the specified portions of the text buffer to a file. Returns - 0 on success - non-zero on error (strerror() contains reason) - 1 indicates open for write failed (no data saved) - 2 indicates error occurred while writing data (data was partially saved) \see savefile(const char *file, int buflen) */ int outputfile(const char *file, int start, int end, int buflen = 128*1024); /** Saves a text file from the current buffer. Returns - 0 on success - non-zero on error (strerror() contains reason) - 1 indicates open for write failed (no data saved) - 2 indicates error occurred while writing data (data was partially saved) \see outputfile(const char *file, int start, int end, int buflen) */ int savefile(const char *file, int buflen = 128*1024) { return outputfile(file, 0, length(), buflen); } /** Gets the tab width. The tab width is measured in characters. The pixel position is calculated using an average character width. */ int tab_distance() const { return mTabDist; } /** Set the hardware tab distance (width) used by all displays for this buffer, and used in computing offsets for rectangular selection operations. */ void tab_distance(int tabDist); /** Selects a range of characters in the buffer. */ void select(int start, int end); /** Returns a non-zero value if text has been selected, 0 otherwise. */ int selected() const { return mPrimary.selected(); } /** Cancels any previous selection on the primary text selection object. */ void unselect(); /** Gets the selection position. */ int selection_position(int* start, int* end); /** Returns the currently selected text. When you are done with the text, free it using the free() function. */ char* selection_text(); /** Removes the text in the primary selection. */ void remove_selection(); /** Replaces the text in the primary selection. */ void replace_selection(const char* text); /** Selects a range of characters in the secondary selection. */ void secondary_select(int start, int end); /** Returns a non-zero value if text has been selected in the secondary text selection, 0 otherwise. */ int secondary_selected() { return mSecondary.selected(); } /** Clears any selection in the secondary text selection object. */ void secondary_unselect(); /** Returns the current selection in the secondary text selection object. */ int secondary_selection_position(int* start, int* end); /** Returns the text in the secondary selection. When you are done with the text, free it using the free() function. */ char* secondary_selection_text(); /** Removes the text from the buffer corresponding to the secondary text selection object. */ void remove_secondary_selection(); /** Replaces the text from the buffer corresponding to the secondary text selection object with the new string \p text. */ void replace_secondary_selection(const char* text); /** Highlights the specified text within the buffer. */ void highlight(int start, int end); /** Returns a non-zero value if text has been highlighted, 0 otherwise. */ int highlight() { return mHighlight.selected(); } /** Unhighlights text in the buffer. */ void unhighlight(); /** Highlights the specified text between \p start and \p end within the buffer. */ int highlight_position(int* start, int* end); /** Returns the highlighted text. When you are done with the text, free it using the free() function. */ char* highlight_text(); /** Adds a callback function that is called whenever the text buffer is modified. The callback function is declared as follows: \code typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted, int nRestyled, const char* deletedText, void* cbArg); \endcode */ void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg); /** Removes a modify callback. */ void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg); /** Calls all modify callbacks that have been registered using the add_modify_callback() method. */ void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); } /** Adds a callback routine to be called before text is deleted from the buffer. */ void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg); /** Removes a callback routine \p bufPreDeleteCB associated with argument \p cbArg to be called before text is deleted from the buffer. */ void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg); /** Calls the stored pre-delete callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners. */ void call_predelete_callbacks() { call_predelete_callbacks(0, 0); } /** Returns the text from the entire line containing the specified character position. When you are done with the text, free it using the free() function. \param pos byte index into buffer \return copy of UTF-8 text, must be free'd */ char* line_text(int pos) const; /** Returns the position of the start of the line containing position \p pos. \param pos byte index into buffer \return byte offset to line start */ int line_start(int pos) const; /** Finds and returns the position of the end of the line containing position \p pos (which is either a pointer to the newline character ending the line or a pointer to one character beyond the end of the buffer). \param pos byte index into buffer \return byte offset to line end */ int line_end(int pos) const; /** Returns the position corresponding to the start of the word. \param pos byte index into buffer \return byte offset to word start */ int word_start(int pos) const; /** Returns the position corresponding to the end of the word. \param pos byte index into buffer \return byte offset to word end */ int word_end(int pos) const; /** Count the number of displayed characters between buffer position \p lineStartPos and \p targetPos. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded. */ int count_displayed_characters(int lineStartPos, int targetPos) const; /** Count forward from buffer position \p startPos in displayed characters. Displayed characters are the characters shown on the screen to represent characters in the buffer, where tabs and control characters are expanded. \param lineStartPos byte offset into buffer \param nChars number of bytes that are sent to the display \return byte offset in input after all output bytes are sent */ int skip_displayed_characters(int lineStartPos, int nChars); /** Counts the number of newlines between \p startPos and \p endPos in buffer. The character at position \p endPos is not counted. */ int count_lines(int startPos, int endPos) const; /** Estimate the number of newlines between \p startPos and \p endPos in buffer. This call takes line wrapping into account. It assumes a line break at every `lineLen` characters after the beginning of a line. */ int estimate_lines(int startPos, int endPos, int lineLen) const; /** Finds the first character of the line \p nLines forward from \p startPos in the buffer and returns its position. */ int skip_lines(int startPos, int nLines); /** Finds and returns the position of the first character of the line \p nLines backwards from \p startPos (not counting the character pointed to by \p startpos if that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line. */ int rewind_lines(int startPos, int nLines); /** Finds the next occurrence of the specified character. Search forwards in buffer for character \p searchChar, starting with the character \p startPos, and returning the result in \p foundPos. Returns 1 if found, 0 if not. The difference between this and search_forward() is that it's optimized for single characters. The overall performance of the text widget is dependent on its ability to count lines quickly, hence searching for a single character: newline. \param startPos byte offset to start position \param searchChar UCS-4 character that we want to find \param foundPos byte offset where the character was found \return 1 if found, 0 if not */ int findchar_forward(int startPos, unsigned searchChar, int* foundPos) const; /** Search backwards in buffer \p buf for character \p searchChar, starting with the character \e before \p startPos, returning the result in \p foundPos. Returns 1 if found, 0 if not. The difference between this and search_backward() is that it's optimized for single characters. The overall performance of the text widget is dependent on its ability to count lines quickly, hence searching for a single character: newline. \param startPos byte offset to start position \param searchChar UCS-4 character that we want to find \param foundPos byte offset where the character was found \return 1 if found, 0 if not */ int findchar_backward(int startPos, unsigned int searchChar, int* foundPos) const; /** Search forwards in buffer for string \p searchString, starting with the character \p startPos, and returning the result in \p foundPos. Returns 1 if found, 0 if not. \param startPos byte offset to start position \param searchString UTF-8 string that we want to find \param foundPos byte offset where the string was found \param matchCase if set, match character case \return 1 if found, 0 if not */ int search_forward(int startPos, const char* searchString, int* foundPos, int matchCase = 0) const; /** Search backwards in buffer for string \p searchString, starting with the character \e at \p startPos, returning the result in \p foundPos. Returns 1 if found, 0 if not. \param startPos byte offset to start position \param searchString UTF-8 string that we want to find \param foundPos byte offset where the string was found \param matchCase if set, match character case \return 1 if found, 0 if not */ int search_backward(int startPos, const char* searchString, int* foundPos, int matchCase = 0) const; /** Returns the primary selection. */ const Fl_Text_Selection* primary_selection() const { return &mPrimary; } /** Returns the primary selection. */ Fl_Text_Selection* primary_selection() { return &mPrimary; } /** Returns the secondary selection. */ const Fl_Text_Selection* secondary_selection() const { return &mSecondary; } /** Returns the current highlight selection. */ const Fl_Text_Selection* highlight_selection() const { return &mHighlight; } /** Returns the index of the previous character. \param ix index to the current character */ int prev_char(int ix) const; int prev_char_clipped(int ix) const; /** Returns the index of the next character. \param ix index to the current character */ int next_char(int ix) const; int next_char_clipped(int ix) const; /** Align an index into the buffer to the current or previous UTF-8 boundary. */ int utf8_align(int) const; /** \brief true if the loaded file has been transcoded to UTF-8. */ int input_file_was_transcoded; /** This message may be displayed using the fl_alert() function when a file which was not UTF-8 encoded is input. */ static const char* file_encoding_warning_message; /** \brief Pointer to a function called after reading a non UTF-8 encoded file. This function is called after reading a file if the file content was transcoded to UTF-8. Its default implementation calls fl_alert() with the text of \ref file_encoding_warning_message. No warning message is displayed if this pointer is set to NULL. Use \ref input_file_was_transcoded to be informed if file input required transcoding to UTF-8. */ void (*transcoding_warning_action)(Fl_Text_Buffer*); bool is_word_separator(int pos) const; protected: /** Calls the stored modify callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners. */ void call_modify_callbacks(int pos, int nDeleted, int nInserted, int nRestyled, const char* deletedText) const; /** Calls the stored pre-delete callback procedure(s) for this buffer to update the changed area(s) on the screen and any other listeners. */ void call_predelete_callbacks(int pos, int nDeleted) const; /** Internal (non-redisplaying) version of insert(). Returns the length of text inserted (this is just strlen(\p text) if \p insertedLength == -1, however this calculation can be expensive and the length will be required by any caller who will continue on to call redisplay). \p pos must be contiguous with the existing text in the buffer (i.e. not past the end). \return the number of bytes inserted */ int insert_(int pos, const char* text, int insertedLength = -1); /** Internal (non-redisplaying) version of remove(). Removes the contents of the buffer between \p start and \p end (and moves the gap to the site of the delete). */ void remove_(int start, int end); /** Calls the stored redisplay procedure(s) for this buffer to update the screen for a change in a selection. */ void redisplay_selection(Fl_Text_Selection* oldSelection, Fl_Text_Selection* newSelection) const; /** Move the gap to start at a new position. */ void move_gap(int pos); /** Reallocates the text storage in the buffer to have a gap starting at \p newGapStart and a gap size of \p newGapLen, preserving the buffer's current contents. */ void reallocate_with_gap(int newGapStart, int newGapLen); char* selection_text_(Fl_Text_Selection* sel) const; /** Removes the text from the buffer corresponding to \p sel. */ void remove_selection_(Fl_Text_Selection* sel); /** Replaces the \p text in selection \p sel. */ void replace_selection_(Fl_Text_Selection* sel, const char* text); /** Updates all of the selections in the buffer for changes in the buffer's text */ void update_selections(int pos, int nDeleted, int nInserted); /** Apply the current undo/redo operation, called from undo() or redo(). */ int apply_undo(Fl_Text_Undo_Action* action, int* cursorPos); Fl_Text_Selection mPrimary; /**< highlighted areas */ Fl_Text_Selection mSecondary; /**< highlighted areas */ Fl_Text_Selection mHighlight; /**< highlighted areas */ int mLength; /**< length of the text in the buffer (the length of the buffer itself must be calculated: gapEnd - gapStart + length) */ char* mBuf; /**< allocated memory where the text is stored */ int mGapStart; /**< points to the first character of the gap */ int mGapEnd; /**< points to the first character after the gap */ // The hardware tab distance used by all displays for this buffer, // and used in computing offsets for rectangular selection operations. int mTabDist; /**< equiv. number of characters in a tab */ int mNModifyProcs; /**< number of modify-redisplay procs attached */ Fl_Text_Modify_Cb *mModifyProcs;/**< procedures to call when buffer is modified to redisplay contents */ void** mCbArgs; /**< caller arguments for modifyProcs above */ int mNPredeleteProcs; /**< number of pre-delete procs attached */ Fl_Text_Predelete_Cb *mPredeleteProcs; /**< procedure to call before text is deleted from the buffer; at most one is supported. */ void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */ int mCursorPosHint; /**< hint for reasonable cursor position after a buffer modification operation */ char mCanUndo; /**< if this buffer is used for attributes, it must not do any undo calls */ int mPreferredGapSize; /**< the default allocation for the text gap is 1024 bytes and should only be increased if frequent and large changes in buffer size are expected */ Fl_Text_Undo_Action* mUndo; /**< local undo event */ Fl_Text_Undo_Action_List* mUndoList; /**< List of undo event */ Fl_Text_Undo_Action_List* mRedoList; /**< List of redo event */ }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Text_Display.H ================================================ // // Header file for Fl_Text_Display class. // // Copyright 2001-2023 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under // the LGPL for the FLTK library granted by Mark Edel. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Text_Display widget . */ #ifndef FL_TEXT_DISPLAY_H #define FL_TEXT_DISPLAY_H #include // Fl::scrollbar_size() #include "fl_draw.H" #include "Fl_Group.H" #include "Fl_Widget.H" #include "Fl_Scrollbar.H" #include "Fl_Text_Buffer.H" /** \brief Rich text display widget. This is the FLTK text display widget. It allows the user to view multiple lines of text and supports highlighting, word wrap, mixes of font faces and colors, line numbers and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class. A single Text Buffer can be displayed by multiple Text Displays. \image html editor.png "Fl_Text_Display widget" \image latex editor.png "Fl_Text_Display widget" width=10cm

    \image html editor-linenumbers.png "Fl_Text_Display widget with line numbers enabled" \image latex editor-linenumbers.png "Fl_Text_Display widget with line numbers enabled" width=10cm \b Example \b Use \code #include .. int main() { .. Fl_Text_Buffer *buff = new Fl_Text_Buffer(); Fl_Text_Display *disp = new Fl_Text_Display(10, 10, 640, 480); disp->buffer(buff); // attach text buffer to display widget buff->text("line one\nline two"); // add some text to buffer .. } \endcode \b Features - Word wrap: wrap_mode(), wrapped_column(), wrapped_row() - Font control: textfont(), textsize(), textcolor() - Font styling: highlight_data() - Cursor: cursor_style(), show_cursor(), hide_cursor(), cursor_color() - Line numbers: linenumber_width(), linenumber_font(), linenumber_size(), linenumber_fgcolor(), linenumber_bgcolor(), linenumber_align(), linenumber_format() Note that other features may be available via Fl_Text_Editor and Fl_Text_Buffer classes. \note Line numbers were added in FLTK 1.3.3. \see Fl_Widget::shortcut_label(int) */ class FL_EXPORT Fl_Text_Display: public Fl_Group { public: /** text display cursor shapes enumeration */ enum { NORMAL_CURSOR, /**< I-beam */ CARET_CURSOR, /**< caret under the text */ DIM_CURSOR, /**< dim I-beam */ BLOCK_CURSOR, /**< unfille box under the current character */ HEAVY_CURSOR, /**< thick I-beam */ SIMPLE_CURSOR /**< as cursor as Fl_Input cursor */ }; /** the character position is the left edge of a character, whereas the cursor is thought to be between the centers of two consecutive characters. */ enum { CURSOR_POS, CHARACTER_POS }; /** drag types - they match Fl::event_clicks() so that single clicking to start a collection selects by character, double clicking selects by word and triple clicking selects by line. */ enum { DRAG_NONE = -2, DRAG_START_DND = -1, DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2 }; /** wrap types - used in wrap_mode() */ enum { WRAP_NONE, /**< don't wrap text at all */ WRAP_AT_COLUMN, /**< wrap text at the given text column */ WRAP_AT_PIXEL, /**< wrap text at a pixel position */ WRAP_AT_BOUNDS /**< wrap text so that it fits into the widget width */ }; friend int fl_text_drag_prepare(int pos, int key, Fl_Text_Display* d); friend void fl_text_drag_me(int pos, Fl_Text_Display* d); typedef void (*Unfinished_Style_Cb)(int, void *); /** This structure associates the color, font, and font size of a string to draw with an attribute mask matching attr. There must be one entry for each style that can be used in an Fl_Text_Display for displaying text. The style table is an array of struct Style_Table_Entry. The style table is associated with an Fl_Text_Display by using Fl_Text_Display::highlight_data(). \see Fl_Text_Display::highlight_data() */ struct Style_Table_Entry { Fl_Color color; ///< text color Fl_Font font; ///< text font Fl_Fontsize size; ///< text font size unsigned attr; ///< further attributes for the text style (see `ATTR_BGCOLOR`, etc.) Fl_Color bgcolor; ///< text background color if `ATTR_BGCOLOR` or `ATTR_BGCOLOR_EXT` is set }; /** attribute flags in `Style_Table_Entry.attr` */ enum { ATTR_BGCOLOR = 0x0001, ///< use the background color in the `bgcolor` field ATTR_BGCOLOR_EXT_ = 0x0002, ///< (internal use) ATTR_BGCOLOR_EXT = 0x0003, ///< extend background color to the end of the line ATTR_UNDERLINE = 0x0004, ///< a single underline, underline types are mutually exclusive ATTR_GRAMMAR = 0x0008, ///< grammar suggestion (blue dotted underline) ATTR_SPELLING = 0x000C, ///< spelling suggestion (red dotted underline) ATTR_STRIKE_THROUGH = 0x0010, ///< line through the middle of the text ATTR_LINES_MASK = 0x001C ///< the mask for all underline and strike through types }; Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0); ~Fl_Text_Display(); int handle(int e) FL_OVERRIDE; void buffer(Fl_Text_Buffer* buf); /** Sets the current text buffer associated with the text widget. Multiple text widgets can be associated with the same text buffer. \param buf new text buffer \see Fl_Text_Display::buffer(Fl_Text_Buffer* buf) */ void buffer(Fl_Text_Buffer& buf) { buffer(&buf); } /** Gets the current text buffer associated with the text widget. Multiple text widgets can be associated with the same text buffer. \return current text buffer \see Fl_Text_Display::buffer(Fl_Text_Buffer* buf) \see Fl_Text_Display::buffer(Fl_Text_Buffer& buf) */ Fl_Text_Buffer* buffer() const { return mBuffer; } /** Gets the current style buffer associated with the text widget. Multiple text widgets can be associated with the same style buffer. \return current style buffer \see Fl_Text_Display::highlight_data() */ Fl_Text_Buffer* style_buffer() const { return mStyleBuffer; } void redisplay_range(int start, int end); void scroll(int topLineNum, int horizOffset); void insert(const char* text); void overstrike(const char* text); void insert_position(int newPos); /** Gets the position of the text insertion cursor for text display. The insert position is the byte count (offset) from the beginning of the text buffer (starting with 0). Returns 0 (zero) if no buffer is associated to the text display. Returns buffer()->length() if the insert position is at the end of the buffer. \returns insert position index into text buffer \see insert_position(int) */ int insert_position() const { return mCursorPos; } int position_to_xy(int pos, int* x, int* y) const; int in_selection(int x, int y) const; void show_insert_position(); int move_right(); int move_left(); int move_up(); int move_down(); int count_lines(int start, int end, bool start_pos_is_line_start) const; int line_start(int pos) const; int line_end(int startPos, bool startPosIsLineStart) const; int skip_lines(int startPos, int nLines, bool startPosIsLineStart); int rewind_lines(int startPos, int nLines); void next_word(void); void previous_word(void); void show_cursor(int b = 1); /** Hides the text cursor. */ void hide_cursor() { show_cursor(0); } void cursor_style(int style); int cursor_style() const { return mCursorStyle; } /** Gets the text cursor color. \return cursor color */ Fl_Color cursor_color() const {return mCursor_color;} /** Sets the text cursor color. \param n new cursor color */ void cursor_color(Fl_Color n) {mCursor_color = n;} /** Returns the global value Fl::scrollbar_size() unless a specific scrollbar_width_ has been set. \deprecated Use scrollbar_size() instead. \todo This method should eventually be removed. */ int scrollbar_width() const { return scrollbar_width_ ? scrollbar_width_ : Fl::scrollbar_size(); } /** Sets the global Fl::scrollbar_size(), and forces this instance of the widget to use it. \deprecated Use scrollbar_size() instead. \todo This method should eventually be removed */ void scrollbar_width(int width) { Fl::scrollbar_size(width); scrollbar_width_ = 0; } /** Gets the current size of the scrollbars' troughs, in pixels. If this value is zero (default), this widget will use the Fl::scrollbar_size() value as the scrollbar's width. \returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used. \see Fl::scrollbar_size(int) */ int scrollbar_size() const { return(scrollbar_width_); } /** Sets the pixel size of the scrollbars' troughs to \p newSize, in pixels. Normally you should not need this method, and should use Fl::scrollbar_size(int) instead to manage the size of ALL your widgets' scrollbars. This ensures your application has a consistent UI, is the default behavior, and is normally what you want. Only use THIS method if you really need to override the global scrollbar size. The need for this should be rare. Setting \p newSize to the special value of 0 causes the widget to track the global Fl::scrollbar_size(), which is the default. \param[in] newSize Sets the scrollbar size in pixels.\n If 0 (default), scrollbar size tracks the global Fl::scrollbar_size() \see Fl::scrollbar_size() */ void scrollbar_size(int newSize) { scrollbar_width_ = newSize; } /** Gets the scrollbar alignment type. \return scrollbar alignment */ Fl_Align scrollbar_align() const { return scrollbar_align_; } /** Sets the scrollbar alignment type. \param a new scrollbar alignment */ void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; } /** Moves the insert position to the beginning of the current word. \param pos start calculation at this index \return beginning of the words */ int word_start(int pos) const { return buffer()->word_start(pos); } /** Moves the insert position to the end of the current word. \param pos start calculation at this index \return index of first character after the end of the word */ int word_end(int pos) const { return buffer()->word_end(pos); } void highlight_data(Fl_Text_Buffer *styleBuffer, const Style_Table_Entry *styleTable, int nStyles, char unfinishedStyle, Unfinished_Style_Cb unfinishedHighlightCB, void *cbArg); int position_style(int lineStartPos, int lineLen, int lineIndex) const; /** \todo FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! \return the current shortcut key */ int shortcut() const {return shortcut_;} /** \todo FIXME : get set methods pointing on shortcut_ have no effects as shortcut_ is unused in this class and derived! \param s the new shortcut key */ void shortcut(int s) {shortcut_ = s;} /** Gets the default font used when drawing text in the widget. \return current text font face unless overridden by a style */ Fl_Font textfont() const {return textfont_;} /** Sets the default font used when drawing text in the widget. \param s default text font face */ void textfont(Fl_Font s) {textfont_ = s; mColumnScale = 0; } /** Gets the default size of text in the widget. \return current text height unless overridden by a style */ Fl_Fontsize textsize() const {return textsize_;} /** Sets the default size of text in the widget. \param s new text size */ void textsize(Fl_Fontsize s) {textsize_ = s; mColumnScale = 0; } /** Gets the default color of text in the widget. \return text color unless overridden by a style */ Fl_Color textcolor() const {return textcolor_;} /** Sets the default color of text in the widget. \param n new text color */ void textcolor(Fl_Color n) {textcolor_ = n;} /** Sets the underline color for style attribute ATTR_GRAMMAR. \param color underline color */ void grammar_underline_color(Fl_Color color) { grammar_underline_color_ = color; } /** Gets the underline color for style attribute ATTR_GRAMMAR. \return underline color */ Fl_Color grammar_underline_color() const { return grammar_underline_color_;} /** Sets the underline color for style attribute ATTR_SPELLING. \param color underline color */ void spelling_underline_color(Fl_Color color) { spelling_underline_color_ = color; } /** Gets the underline color for style attribute ATTR_SPELLING. \return underline color */ Fl_Color spelling_underline_color() const { return spelling_underline_color_;} /** Sets the background color for the secondary selection block. \param color background color */ void secondary_selection_color(Fl_Color color) { secondary_selection_color_ = color; } /** Gets the background color for the secondary selection block. \return background color color */ Fl_Color secondary_selection_color() const { return secondary_selection_color_;} int wrapped_column(int row, int column) const; int wrapped_row(int row) const; void wrap_mode(int wrap, int wrap_margin); virtual void recalc_display(); virtual void display_needs_recalc(); void resize(int X, int Y, int W, int H) FL_OVERRIDE; /** Convert an x pixel position into a column number. \param x number of pixels from the left margin \return an approximate column number based on the main font */ double x_to_col(double x) const; /** Convert a column number into an x pixel position. \param col an approximate column number based on the main font \return number of pixels from the left margin to the left of an average sized character */ double col_to_x(double col) const; void linenumber_width(int width); int linenumber_width() const; void linenumber_font(Fl_Font val); Fl_Font linenumber_font() const; void linenumber_size(Fl_Fontsize val); Fl_Fontsize linenumber_size() const; void linenumber_fgcolor(Fl_Color val); Fl_Color linenumber_fgcolor() const; void linenumber_bgcolor(Fl_Color val); Fl_Color linenumber_bgcolor() const; void linenumber_align(Fl_Align val); Fl_Align linenumber_align() const; void linenumber_format(const char* val); const char* linenumber_format() const; protected: // Most (all?) of this stuff should only be called from resize() or // draw(). // Anything with "vline" indicates thats it deals with currently // visible lines. void draw() FL_OVERRIDE; void draw_text(int X, int Y, int W, int H); void draw_range(int start, int end); void draw_cursor(int, int); void draw_string(int style, int x, int y, int toX, const char *string, int nChars) const; void draw_vline(int visLineNum, int leftClip, int rightClip, int leftCharIndex, int rightCharIndex); int find_x(const char *s, int len, int style, int x) const; enum { DRAW_LINE, FIND_INDEX, FIND_INDEX_FROM_ZERO, GET_WIDTH, FIND_CURSOR_INDEX // STR #2788 }; int handle_vline(int mode, int lineStart, int lineLen, int leftChar, int rightChar, int topClip, int bottomClip, int leftClip, int rightClip) const; int handle_rmb(int readonly); void draw_line_numbers(bool clearAll); void clear_rect(int style, int x, int y, int width, int height) const; void display_insert(); void offset_line_starts(int newTopLineNum); void calc_line_starts(int startLine, int endLine); void update_line_starts(int pos, int charsInserted, int charsDeleted, int linesInserted, int linesDeleted, int *scrolled); void calc_last_char(); int position_to_line( int pos, int* lineNum ) const; double string_width(const char* string, int length, int style) const; static void scroll_timer_cb(void*); static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg); static void buffer_modified_cb(int pos, int nInserted, int nDeleted, int nRestyled, const char* deletedText, void* cbArg); static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display* d); static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display* d); void update_v_scrollbar(); void update_h_scrollbar(); int measure_vline(int visLineNum) const; int longest_vline() const; int empty_vlines() const; int vline_length(int visLineNum) const; int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const; void xy_to_rowcol(int x, int y, int* row, int* column, int PosType = CHARACTER_POS) const; void maintain_absolute_top_line_number(int state); public: int get_absolute_top_line_number() const; int scroll_row() { return mTopLineNum; } int scroll_col() { return mHorizOffset; } protected: void absolute_top_line_number(int oldFirstChar); int maintaining_absolute_top_line_number() const; void reset_absolute_top_line_number(); int position_to_linecol(int pos, int* lineNum, int* column) const; int scroll_(int topLineNum, int horizOffset); void extend_range_for_styles(int* start, int* end); void find_wrap_range(const char *deletedText, int pos, int nInserted, int nDeleted, int *modRangeStart, int *modRangeEnd, int *linesInserted, int *linesDeleted); void measure_deleted_lines(int pos, int nDeleted); void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset, int *retPos, int *retLines, int *retLineStart, int *retLineEnd, bool countLastLineMissingNewLine = true) const; void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd, int *nextLineStart) const; double measure_proportional_character(const char *s, int colNum, int pos) const; int wrap_uses_character(int lineEndPos) const; int damage_range1_start, damage_range1_end; int damage_range2_start, damage_range2_end; int mCursorPos; int mCursorOn; int mCursorOldY; /* Y pos. of cursor for blanking */ int mCursorToHint; /* Tells the buffer modified callback where to move the cursor, to reduce the number of redraw calls */ int mCursorStyle; /* One of enum cursorStyles above */ int mCursorPreferredXPos; /* Pixel position for vert. cursor movement */ int mNVisibleLines; /* # of visible (displayed) lines. This is also the size of the mLineStarts[] array. */ int mNBufferLines; /* # of newlines in the buffer, or number of wraps if line wrapping is enabled. Note that partial lines at the end of the buffer are not counted, so you may want to add 1. */ Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */ Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing color and font information */ int mFirstChar, mLastChar; /* Buffer positions of first and last displayed character (lastChar points either to a newline or one character beyond the end of the buffer) */ int mContinuousWrap; /* Wrap long lines when displaying */ int mWrapMarginPix; /* Margin in # of pixels for wrapping in continuousWrap mode */ int* mLineStarts; /* Array of the size mNVisibleLines. This array only keeps track of lines within the display area. Each entry contains the starting character offset (from the beginning of the text buffer) for each /visible/ line. If wrap enabled, points to the beginning of each wrap. So a long line wrapping into 3 separate lines in the display will take up 3 separate array entries. */ int mTopLineNum; /* Line number of top displayed line of file (first line of file is 1) */ int mAbsTopLineNum; /* In continuous wrap mode, the line number of the top line if the text were not wrapped (note that this is only maintained as needed). */ int mNeedAbsTopLineNum; /* Externally settable flag to continue maintaining absTopLineNum even if it isn't needed for line # display */ int mHorizOffset; /* Horizontal scroll pos. in pixels */ int mTopLineNumHint; /* Line number of top displayed line of file (first line of file is 1) */ int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */ int mNStyles; /* Number of entries in styleTable */ const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for coloring/syntax-highlighting */ char mUnfinishedStyle; /* Style buffer entry which triggers on-the-fly reparsing of region */ Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */ /* regions */ void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */ int mMaxsize; int mSuppressResync; /* Suppress resynchronization of line starts during buffer updates */ int mNLinesDeleted; /* Number of lines deleted during buffer modification (only used when resynchronization is suppressed) */ int mModifyingTabDistance; /* Whether tab distance is being modified XXX: UNUSED */ mutable double mColumnScale; /* Width in pixels of an average character. This value is calculated as needed (lazy eval); it needs to be mutable so that it can be calculated within a method marked as "const" */ bool display_needs_recalc_; /* Set to true when the display needs to be recalculated. */ Fl_Color mCursor_color; Fl_Scrollbar* mHScrollBar; Fl_Scrollbar* mVScrollBar; int scrollbar_width_; // size of scrollbar trough (behavior changed in 1.4) Fl_Align scrollbar_align_; int dragPos, dragType, dragging; int display_insert_position_hint; struct { int x, y, w, h; } text_area; int shortcut_; Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; Fl_Color grammar_underline_color_; Fl_Color spelling_underline_color_; Fl_Color secondary_selection_color_; // Line number margin and width int mLineNumLeft, mLineNumWidth; // Line number font/colors Fl_Font linenumber_font_; Fl_Fontsize linenumber_size_; Fl_Color linenumber_fgcolor_; Fl_Color linenumber_bgcolor_; Fl_Align linenumber_align_; const char* linenumber_format_; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Text_Editor.H ================================================ // // Header file for Fl_Text_Editor class. // // Copyright 2001-2023 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under // the LGPL for the FLTK library granted by Mark Edel. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Text_Editor widget . */ #ifndef FL_TEXT_EDITOR_H #define FL_TEXT_EDITOR_H #include "Fl_Text_Display.H" // key will match in any state #define FL_TEXT_EDITOR_ANY_STATE (-1L) /** This is the FLTK text editor widget. It allows the user to edit multiple lines of text and supports highlighting and scrolling. The buffer that is displayed in the widget is managed by the Fl_Text_Buffer class. */ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display { public: /** Key function binding callback type. */ typedef int (*Key_Func)(int key, Fl_Text_Editor* editor); /** Simple linked list item associating a key/state to a function. */ struct Key_Binding { int key; ///< the key pressed int state; ///< the state of key modifiers Key_Func function; ///< associated function Key_Binding* next; ///< next key binding in the list }; Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0); ~Fl_Text_Editor() { remove_all_key_bindings(); } int handle(int e) FL_OVERRIDE; /** Sets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position. */ void insert_mode(int b) { insert_mode_ = b; } /** Gets the current insert mode; if non-zero, new text is inserted before the current cursor position. Otherwise, new text replaces text at the current cursor position. */ int insert_mode() { return insert_mode_; } void tab_nav(int val); int tab_nav() const; void add_key_binding(int key, int state, Key_Func f, Key_Binding** list); /** Adds a \p key of state \p state with the function \p f. */ void add_key_binding(int key, int state, Key_Func f) { add_key_binding(key, state, f, &key_bindings); } void remove_key_binding(int key, int state, Key_Binding** list); /** Removes the key binding associated with the key "key" of state "state". */ void remove_key_binding(int key, int state) { remove_key_binding(key, state, &key_bindings); } void remove_all_key_bindings(Key_Binding** list); /** Removes all of the key bindings associated with the text editor or list. */ void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); } void add_default_key_bindings(Key_Binding** list); Key_Func bound_key_function(int key, int state, Key_Binding* list) const; /** Returns the function associated with a key binding. */ Key_Func bound_key_function(int key, int state) const { return bound_key_function(key, state, key_bindings); } /** Sets the default key function for unassigned keys. */ void default_key_function(Key_Func f) { default_key_function_ = f; } // functions for the built in default bindings static int kf_default(int c, Fl_Text_Editor* e); static int kf_ignore(int c, Fl_Text_Editor* e); static int kf_backspace(int c, Fl_Text_Editor* e); static int kf_enter(int c, Fl_Text_Editor* e); static int kf_move(int c, Fl_Text_Editor* e); static int kf_shift_move(int c, Fl_Text_Editor* e); static int kf_ctrl_move(int c, Fl_Text_Editor* e); static int kf_c_s_move(int c, Fl_Text_Editor* e); static int kf_meta_move(int c, Fl_Text_Editor* e); static int kf_m_s_move(int c, Fl_Text_Editor* e); static int kf_home(int, Fl_Text_Editor* e); static int kf_end(int c, Fl_Text_Editor* e); static int kf_left(int c, Fl_Text_Editor* e); static int kf_up(int c, Fl_Text_Editor* e); static int kf_right(int c, Fl_Text_Editor* e); static int kf_down(int c, Fl_Text_Editor* e); static int kf_page_up(int c, Fl_Text_Editor* e); static int kf_page_down(int c, Fl_Text_Editor* e); static int kf_insert(int c, Fl_Text_Editor* e); static int kf_delete(int c, Fl_Text_Editor* e); static int kf_copy(int c, Fl_Text_Editor* e); static int kf_cut(int c, Fl_Text_Editor* e); static int kf_paste(int c, Fl_Text_Editor* e); static int kf_select_all(int c, Fl_Text_Editor* e); static int kf_undo(int c, Fl_Text_Editor* e); static int kf_redo(int c, Fl_Text_Editor* e); protected: int handle_key(); void maybe_do_callback(Fl_Callback_Reason reason = FL_REASON_CHANGED); #ifndef FL_DOXYGEN int insert_mode_; Key_Binding* key_bindings; #endif /** Global key binding list. Derived classes can add key bindings for all Fl_Text_Editor widgets by adding a Key_Binding to this list. \see add_key_binding(int key, int state, Key_Func f, Key_Binding** list); */ static Key_Binding* global_key_bindings; #ifndef FL_DOXYGEN Key_Func default_key_function_; #endif }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Tile.H ================================================ // // Tile header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Tile_H #define Fl_Tile_H #include "Fl_Group.H" /* The Fl_Tile class lets you resize its children by dragging the border between them. */ class FL_EXPORT Fl_Tile : public Fl_Group { public: int handle(int event) FL_OVERRIDE; Fl_Tile(int X, int Y, int W, int H, const char *L=0); ~Fl_Tile() FL_OVERRIDE; void resize(int X, int Y, int W, int H) FL_OVERRIDE; virtual void move_intersection(int oldx, int oldy, int newx, int newy); virtual void drag_intersection(int oldx, int oldy, int newx, int newy); FL_DEPRECATED("since 1.4.0 - use move_intersection(p) instead", void position(int oldx, int oldy, int newx, int newy)) { move_intersection(oldx, oldy, newx, newy); } void position(int x, int y) { Fl_Group::position(x, y); } void size_range(int index, int minw, int minh, int maxw=0x7FFFFFFF, int maxh=0x7FFFFFFF); void size_range(Fl_Widget *w , int minw, int minh, int maxw=0x7FFFFFFF, int maxh=0x7FFFFFFF); void init_size_range(int default_min_w = -1, int default_min_h = -1); protected: int cursor_; ///< current cursor index (0..3) Fl_Cursor *cursors_; ///< points at the array of 4 cursors (may be overridden) /** Returns the cursor for cursor index n. \see Fl_Tile::set_cursor(int) */ Fl_Cursor cursor(int n) { return cursors_[n]; } void set_cursor(int n); // set one of n (0..3) cursors typedef struct { int minw, minh, maxw, maxh; } Size_Range; Size_Range *size_range_; int size_range_size_, size_range_capacity_; int default_min_w_, default_min_h_; void request_shrink_l(int old_l, int &new_l, Fl_Rect *final_size); void request_shrink_r(int old_r, int &new_r, Fl_Rect *final_size); void request_shrink_t(int old_t, int &new_t, Fl_Rect *final_size); void request_shrink_b(int old_b, int &new_b, Fl_Rect *final_size); void request_grow_l(int old_l, int &new_l, Fl_Rect *final_size); void request_grow_r(int old_r, int &new_r, Fl_Rect *final_size); void request_grow_t(int old_t, int &new_t, Fl_Rect *final_size); void request_grow_b(int old_b, int &new_b, Fl_Rect *final_size); int on_insert(Fl_Widget*, int) FL_OVERRIDE; int on_move(int, int) FL_OVERRIDE; void on_remove(int) FL_OVERRIDE; }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Tiled_Image.H ================================================ // // Tiled image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2015 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Tiled_Image widget . */ #ifndef Fl_Tiled_Image_H # define Fl_Tiled_Image_H # include "Fl_Image.H" /** This class supports tiling of images over a specified area. The source (tile) image is \b not copied unless you call the color_average(), desaturate(), or inactive() methods. */ class FL_EXPORT Fl_Tiled_Image : public Fl_Image { protected: Fl_Image *image_; // The image that is tiled int alloc_image_; // Did we allocate this image? public: Fl_Tiled_Image(Fl_Image *i, int W = 0, int H = 0); virtual ~Fl_Tiled_Image(); Fl_Image *copy(int W, int H) const FL_OVERRIDE; Fl_Image *copy() const { return Fl_Image::copy(); } void color_average(Fl_Color c, float i) FL_OVERRIDE; void desaturate() FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0) FL_OVERRIDE; void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); } /** Gets The image that is tiled */ Fl_Image *image() { return image_; } }; #endif // !Fl_Tiled_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_Timer.H ================================================ // // Timer header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Timer widget . */ #ifndef Fl_Timer_H #define Fl_Timer_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif // values for type(): #define FL_NORMAL_TIMER 0 #define FL_VALUE_TIMER 1 #define FL_HIDDEN_TIMER 2 /** This is provided only to emulate the Forms Timer widget. It works by making a timeout callback every 1/5 second. This is wasteful and inaccurate if you just want something to happen a fixed time in the future. You should directly call Fl::add_timeout() instead. */ class FL_EXPORT Fl_Timer : public Fl_Widget { static void stepcb(void *); void step(); char on, direction_; double delay, total; long lastsec,lastusec; protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Timer(uchar t,int x,int y,int w,int h, const char *l); ~Fl_Timer(); void value(double); /** See void Fl_Timer::value(double) */ double value() const {return delay>0.0?delay:0.0;} /** Gets or sets the direction of the timer. If the direction is zero then the timer will count up, otherwise it will count down from the initial value(). */ char direction() const {return direction_;} /** Gets or sets the direction of the timer. If the direction is zero then the timer will count up, otherwise it will count down from the initial value(). */ void direction(char d) {direction_ = d;} /** Gets or sets whether the timer is suspended. */ char suspended() const {return !on;} void suspended(char d); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Toggle_Button.H ================================================ // // Toggle button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Toggle_Button widget . */ #ifndef Fl_Toggle_Button_H #define Fl_Toggle_Button_H #include "Fl_Button.H" /** The toggle button is a push button that needs to be clicked once to toggle on, and one more time to toggle off. The Fl_Toggle_Button subclass displays the "on" state by drawing a pushed-in button.

    Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when(). */ class FL_EXPORT Fl_Toggle_Button : public Fl_Button { public: /** Creates a new Fl_Toggle_Button widget using the given position, size, and label string.

    The inherited destructor deletes the toggle button. */ Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Toggle_Light_Button.H ================================================ // // Toggle light button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // provided for back-compatibility only #ifndef Fl_Toggle_Light_Button #include "Fl_Light_Button.H" #define Fl_Toggle_Light_Button Fl_Light_Button #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Toggle_Round_Button.H ================================================ // // Toggle round button header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // provided for back-compatibility only #ifndef Fl_Toggle_Round_Button #include "Fl_Round_Button.H" #define Fl_Toggle_Round_Button Fl_Round_Button #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Tooltip.H ================================================ // // Tooltip header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2011 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Tooltip widget . */ #ifndef Fl_Tooltip_H #define Fl_Tooltip_H #include #include /** The Fl_Tooltip class provides tooltip support for all FLTK widgets. It contains only static methods. \image html tooltip-options.png "Fl_Tooltip Options" \image latex src/tooltip-options.png "Fl_Tooltip Options" width=6cm */ class FL_EXPORT Fl_Tooltip { friend class Fl_TooltipBox; public: /** Gets the tooltip delay. The default delay is 1.0 seconds. */ static float delay() { return delay_; } /** Sets the tooltip delay. The default delay is 1.0 seconds. */ static void delay(float f) { delay_ = f; } /** Gets the time until an open tooltip hides again. The default delay is 12.0 seconds. */ static float hidedelay() { return hidedelay_; } /** Sets the time until an open tooltip hides again. The default delay is 12.0 seconds. */ static void hidedelay(float f) { hidedelay_ = f; } /** Gets the tooltip hover delay, the delay between tooltips. The default delay is 0.2 seconds. */ static float hoverdelay() { return hoverdelay_; } /** Sets the tooltip hover delay, the delay between tooltips. The default delay is 0.2 seconds. */ static void hoverdelay(float f) { hoverdelay_ = f; } /** Returns non-zero if tooltips are enabled. */ static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); } /** Enables tooltips on all widgets (or disables if b is false). */ static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));} /** Same as enable(0), disables tooltips on all widgets. */ static void disable() { enable(0); } static void (*enter)(Fl_Widget* w); static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip); static void (*exit)(Fl_Widget *w); /** Gets the current widget target */ static Fl_Widget* current() {return widget_;} static void current(Fl_Widget*); /** Gets the typeface for the tooltip text. */ static Fl_Font font() { return font_; } /** Sets the typeface for the tooltip text. */ static void font(Fl_Font i) { font_ = i; } /** Gets the size of the tooltip text. */ static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); } /** Sets the size of the tooltip text. */ static void size(Fl_Fontsize s) { size_ = s; } /** Gets the background color for tooltips. The default background color is a pale yellow. */ static Fl_Color color() { return color_; } /** Sets the background color for tooltips. The default background color is a pale yellow. */ static void color(Fl_Color c) { color_ = c; } /** Gets the color of the text in the tooltip. The default is black. */ static Fl_Color textcolor() { return textcolor_; } /** Sets the color of the text in the tooltip. The default is black. */ static void textcolor(Fl_Color c) { textcolor_ = c; } /** Gets the amount of extra space left/right of the tooltip's text. Default is 3. */ static int margin_width() { return margin_width_; } /** Sets the amount of extra space left/right of the tooltip's text. Default is 3. */ static void margin_width(int v) { margin_width_ = v; } /** Gets the amount of extra space above and below the tooltip's text. Default is 3. */ static int margin_height() { return margin_height_; } /** Sets the amount of extra space above and below the tooltip's text. Default is 3. */ static void margin_height(int v) { margin_height_ = v; } /** Gets the maximum width for tooltip's text before it word wraps. Default is 400. */ static int wrap_width() { return wrap_width_; } /** Sets the maximum width for tooltip's text before it word wraps. Default is 400. */ static void wrap_width(int v) { wrap_width_ = v; } /** Returns the window that is used for tooltips */ static Fl_Window* current_window(void); // These should not be public, but Fl_Widget::tooltip() needs them... // fabien: made it private with only a friend function access private: friend void Fl_Widget::tooltip(const char *); friend void Fl_Widget::copy_tooltip(const char *); static void enter_(Fl_Widget* w); static void exit_(Fl_Widget *w); static void set_enter_exit_once_(); private: static float delay_; //!< delay before a tooltip is shown static float hidedelay_; //!< delay until tooltip is closed again static float hoverdelay_; //!< delay between tooltips static Fl_Color color_; static Fl_Color textcolor_; static Fl_Font font_; static Fl_Fontsize size_; static Fl_Widget* widget_; //!< Keeps track of the current target widget static int margin_width_; //!< distance around tooltip text left+right static int margin_height_; //!< distance around tooltip text top+bottom static int wrap_width_; //!< maximum width of tooltip text before it word wraps static const int draw_symbols_; // 1 = draw @-symbols in tooltips, 0 = no }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Tree.H ================================================ // #ifndef FL_TREE_H #define FL_TREE_H #include #include #include #include #include #include ////////////////////// // FL/Fl_Tree.H ////////////////////// // // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK // Copyright (C) 2009-2010 by Greg Ercolano. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /// /// \file /// \brief This file contains the definitions of the Fl_Tree class /// /** \class Fl_Tree \brief Tree widget. \image html tree-simple.png "Fl_Tree example program" \image latex tree-simple.png "Fl_Tree example program" width=4cm \code Fl_Tree // Top level widget |--- Fl_Tree_Item // Items in the tree |--- Fl_Tree_Prefs // Preferences for the tree |--- Fl_Tree_Connector (enum) // Connection modes |--- Fl_Tree_Select (enum) // Selection modes |--- Fl_Tree_Sort (enum) // Sort behavior \endcode Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's arranged in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed. Items can be added, deleted, inserted, sorted and re-ordered. The tree items may also contain other FLTK widgets, like buttons, input fields, or even "custom" widgets. The callback() is invoked depending on the value of when(): - FL_WHEN_RELEASE -- callback invoked when left mouse button is released on an item - FL_WHEN_CHANGED -- callback invoked when left mouse changes selection state The simple way to define a tree: \par \code #include [..] Fl_Tree tree(X,Y,W,H); tree.begin(); tree.add("Flintstones/Fred"); tree.add("Flintstones/Wilma"); tree.add("Flintstones/Pebbles"); tree.add("Simpsons/Homer"); tree.add("Simpsons/Marge"); tree.add("Simpsons/Bart"); tree.add("Simpsons/Lisa"); tree.end(); \endcode \par FEATURES Items can be added with add(),
    removed with remove(),
    completely cleared with clear(),
    inserted with insert() and insert_above(),
    selected/deselected with select() and deselect(),
    open/closed with open() and close(),
    positioned on the screen with show_item_top(), show_item_middle() and show_item_bottom(),
    item children can be swapped around with Fl_Tree_Item::swap_children(),
    items can be moved around with Fl_Tree_Item::move(),
    an item's children can be walked with Fl_Tree_Item::first() and Fl_Tree_Item::next(), an item's children can be indexed directly with Fl_Tree_Item::child() and Fl_Tree_Item::children(),
    items can be moved from one subtree to another with Fl_Tree_Item::deparent() and Fl_Tree_Item::reparent(),
    sorting can be controlled when items are add()ed via sortorder().
    You can walk the entire tree with first() and next().
    You can walk visible items with first_visible_item() and next_visible_item().
    You can walk selected items with first_selected_item() and next_selected_item().
    Items can be found by their pathname using find_item(const char*), and an item's pathname can be found with item_pathname().
    The selected items' colors are controlled by selection_color() (inherited from Fl_Widget).
    A hook is provided to allow you to redefine how item's labels are drawn via Fl_Tree::item_draw_callback().
    Items can be interactively dragged using FL_TREE_SELECT_SINGLE_DRAGGABLE. \par SELECTION OF ITEMS The tree can have different selection behaviors controlled by selectmode(). The background color used for selected items is the Fl_Tree::selection_color(). The foreground color for selected items is controlled internally with fl_contrast(). \par CHILD WIDGETS FLTK widgets (including custom widgets) can be assigned to tree items via Fl_Tree_Item::widget(). \par When an Fl_Tree_Item::widget() is defined, the default behavior is for the widget() to be shown in place of the item's label (if it has one). Only the widget()'s width will be used; the widget()'s x() and y() position will be managed by the tree, and the h() will track the item's height. This default behavior can be altered (ABI 1.3.1): Setting Fl_Tree::item_draw_mode()'s FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET flag causes the label + widget to be displayed together in that order, and adding the FL_TREE_ITEM_HEIGHT_FROM_WIDGET flag causes widget's height to define the widget()'s height. \par ICONS The tree's open/close icons can be redefined with Fl_Tree::openicon(), Fl_Tree::closeicon(). User icons can either be changed globally with Fl_Tree::usericon(), or on a per-item basis with Fl_Tree_Item::usericon(). \par Various default preferences can be globally manipulated via Fl_Tree_Prefs, including colors, margins, icons, connection lines, etc. \par FONTS AND COLORS When adding new items to the tree, the new items get the defaults for fonts and colors from: \par - Fl_Tree::item_labelfont() -- The default item label font (default: FL_HELVETICA) - Fl_Tree::item_labelsize() -- The default item label size (default: FL_NORMAL_SIZE) - Fl_Tree::item_labelfgcolor() -- The default item label foreground color (default: FL_FOREGROUND_COLOR) - Fl_Tree::item_labelbgcolor() -- The default item label background color (default: 0xffffffff, which tree uses as 'transparent') \par Each item (Fl_Tree_Item) inherits a copy of these font/color attributes when created, and each item has its own methods to let the app change these values on a per-item basis using methods of the same name: \par - Fl_Tree_Item::labelfont() -- The item's label font (default: FL_HELVETICA) - Fl_Tree_Item::labelsize() -- The item's label size (default: FL_NORMAL_SIZE) - Fl_Tree_Item::labelfgcolor() -- The item's label foreground color (default: FL_FOREGROUND_COLOR) - Fl_Tree_Item::labelbgcolor() -- The item's label background color (default: 0xffffffff, which uses the tree's own bg color) \par CALLBACKS The tree's callback() will be invoked when items change state or are open/closed. when() controls when mouse/keyboard events invoke the callback. callback_item() and callback_reason() can be used to determine the cause of the callback. e.g. \par \code void MyTreeCallback(Fl_Widget *w, void *data) { Fl_Tree *tree = (Fl_Tree*)w; Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); // get selected item switch ( tree->callback_reason() ) { case FL_TREE_REASON_SELECTED: [..] case FL_TREE_REASON_DESELECTED: [..] case FL_TREE_REASON_RESELECTED: [..] case FL_TREE_REASON_OPENED: [..] case FL_TREE_REASON_CLOSED: [..] } : } \endcode \par SIMPLE EXAMPLES To find all the selected items: \par \code for ( Fl_Tree_Item *i=first_selected_item(); i; i=next_selected_item(i) ) printf("Item %s is selected\n", i->label()); \endcode \par To get an item's full menu pathname, use Fl_Tree::item_pathname(), e.g. \par \code [..] char pathname[256] = "???"; tree->item_pathname(pathname, sizeof(pathname), item); // eg. "Parent/Child/Item" [..] \endcode \par To walk all the items of the tree from top to bottom: \par \code // Walk all the items in the tree, and print their labels for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { printf("Item: %s\n", item->label()); } \endcode \par To recursively walk all the children of a particular item, define a function that uses recursion: \par \code // Find all of the item's children and print an indented report of their labels void my_print_all_children(Fl_Tree_Item *item, int indent=0) { for ( int t=0; tchildren(); t++ ) { printf("%*s Item: %s\n", indent, "", item->child(t)->label()); my_print_all_children(item->child(t), indent+4); // recurse } } \endcode \par To change the default label font and color when creating new items: \par \code tree = new Fl_Tree(..); tree->item_labelfont(FL_COURIER); // Use Courier font for all new items tree->item_labelfgcolor(FL_RED); // Use red color for labels of all new items [..] // Now create the items in the tree using the above defaults. tree->add("Aaa"); tree->add("Bbb"); \endcode \par To change the font and color of all existing items in the tree: \par \code // Change the font and color of all items currently in the tree for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) { item->labelfont(FL_COURIER); item->labelcolor(FL_RED); } \endcode \par DISPLAY DESCRIPTION The following image shows the tree's various visual elements and the methods that control them: \par \image html tree-elements.png \image latex tree-elements.png "Fl_Tree elements" width=6cm \par The following shows the protected dimension variables 'tree inner' (tix..) and 'tree outer' (tox..): \image html tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm \image latex tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm \par KEYBOARD BINDINGS The following table lists keyboard bindings for navigating the tree: \par Keyboard | FL_TREE_SELECT_MULTI | FL_TREE_SELECT_SINGLE | FL_TREE_SELECT_NONE | ------------------------|-----------------------------|-----------------------------|-----------------------------| Ctrl-A (Linux/Windows) | Select all items | N/A | N/A | Command-A (Mac) | Select all items | N/A | N/A | Space | Selects item | Selects item | N/A | Ctrl-Space | Toggle item | Toggle item | N/A | Shift-Space | Extends selection | Selects item | N/A | Enter | Toggles open/close | Toggles open/close | Toggles open/close | Ctrl-Enter | Toggles open/close | Toggles open/close | Toggles open/close | Shift-Enter | Toggles open/close | Toggles open/close | Toggles open/close | Right / Left | Open/Close item | Open/Close item | Open/Close item | Up / Down | Move focus box up/down | Move focus box up/down | N/A | Shift-Up / Shift-Down | Extend selection up/down | Move focus up/down | N/A | Home / End | Move to top/bottom of tree | Move to top/bottom of tree | Move to top/bottom of tree | PageUp / PageDown | Page up/down | Page up/down | Page up/down | */ /// \enum Fl_Tree_Reason /// The reason the callback was invoked. /// enum Fl_Tree_Reason { FL_TREE_REASON_NONE = FL_REASON_UNKNOWN, ///< unknown reason FL_TREE_REASON_SELECTED = FL_REASON_SELECTED, ///< an item was selected FL_TREE_REASON_DESELECTED = FL_REASON_DESELECTED, ///< an item was de-selected FL_TREE_REASON_RESELECTED = FL_REASON_RESELECTED, ///< an item was re-selected (double-clicked). ///< See ::Fl_Tree_Item_Reselect_Mode to enable this. FL_TREE_REASON_OPENED = FL_REASON_OPENED, ///< an item was opened FL_TREE_REASON_CLOSED = FL_REASON_CLOSED, ///< an item was closed FL_TREE_REASON_DRAGGED = FL_REASON_DRAGGED ///< an item was dragged into a new place }; class FL_EXPORT Fl_Tree : public Fl_Group { friend class Fl_Tree_Item; Fl_Tree_Item *_root; // can be null! Fl_Tree_Item *_item_focus; // item that has focus box Fl_Tree_Item *_callback_item; // item invoked during callback (can be NULL) Fl_Tree_Reason _callback_reason; // reason for the callback Fl_Tree_Prefs _prefs; // all the tree's settings int _scrollbar_size; // size of scrollbar trough Fl_Tree_Item *_lastselect; // last selected item char _lastpushed; // FL_PUSH occurred on: 0=nothing, 1=open/close, 2=usericon, 3=label void fix_scrollbar_order(); protected: Fl_Scrollbar *_vscroll; ///< Vertical scrollbar Fl_Scrollbar *_hscroll; ///< Horizontal scrollbar int _tox,_toy,_tow,_toh; ///< Tree widget outer xywh dimension: outside scrollbars, inside widget border int _tix,_tiy,_tiw,_tih; ///< Tree widget inner xywh dimension: inside borders + scrollbars /// the calculated width of the entire tree hierarchy. See calc_tree() int _tree_w; /// the calculated height of the entire tree hierarchy. See calc_tree() int _tree_h; void item_clicked(Fl_Tree_Item* val); void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason); // next_visible_item() and extend_selection() moved to 'public' in ABI 1.3.3 // undocmented draw_tree() dropped -- draw() does all the work now // draw() has to be protected per FLTK convention (was public in 1.3.x) void draw() FL_OVERRIDE; public: Fl_Tree(int X, int Y, int W, int H, const char *L=0); ~Fl_Tree(); int handle(int e) FL_OVERRIDE; void show_self(); void resize(int,int,int,int) FL_OVERRIDE; /////////////////////// // root methods /////////////////////// void root_label(const char *new_label); Fl_Tree_Item* root(); void root(Fl_Tree_Item *newitem); const Fl_Tree_Prefs& prefs() const { return _prefs; } //////////////////////////////// // Item creation/removal methods //////////////////////////////// Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem=0); Fl_Tree_Item* add(Fl_Tree_Item *parent_item, const char *name); Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name); Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos); int remove(Fl_Tree_Item *item); void clear(); void clear_children(Fl_Tree_Item *item); //////////////////////// // Item lookup methods //////////////////////// Fl_Tree_Item *find_item(const char *path); const Fl_Tree_Item *find_item(const char *path) const; int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const; const Fl_Tree_Item* find_clicked(int yonly=0) const; Fl_Tree_Item* find_clicked(int yonly=0); Fl_Tree_Item *item_clicked(); Fl_Tree_Item *first(); Fl_Tree_Item *first_visible(); // deprecated in ABI 10303 Fl_Tree_Item *first_visible_item(); Fl_Tree_Item *next(Fl_Tree_Item *item=0); Fl_Tree_Item *prev(Fl_Tree_Item *item=0); Fl_Tree_Item *last(); Fl_Tree_Item *last_visible(); // deprecated in ABI 10303 Fl_Tree_Item *last_visible_item(); Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir); // made public in 1.3.3 ABI Fl_Tree_Item *first_selected_item(); Fl_Tree_Item *last_selected_item(); Fl_Tree_Item *next_item(Fl_Tree_Item *item, int dir=FL_Down, bool visible=false); Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0, int dir=FL_Down); int get_selected_items(Fl_Tree_Item_Array &items); ////////////////////////// // Item open/close methods ////////////////////////// int open(Fl_Tree_Item *item, int docallback=1); int open(const char *path, int docallback=1); void open_toggle(Fl_Tree_Item *item, int docallback=1); int close(Fl_Tree_Item *item, int docallback=1); int close(const char *path, int docallback=1); int is_open(Fl_Tree_Item *item) const; int is_open(const char *path) const; int is_close(Fl_Tree_Item *item) const; int is_close(const char *path) const; ///////////////////////// // Item selection methods ///////////////////////// int select(Fl_Tree_Item *item, int docallback=1); int select(const char *path, int docallback=1); void select_toggle(Fl_Tree_Item *item, int docallback=1); int deselect(Fl_Tree_Item *item, int docallback=1); int deselect(const char *path, int docallback=1); int deselect_all(Fl_Tree_Item *item=0, int docallback=1); int select_only(Fl_Tree_Item *selitem, int docallback=1); int select_all(Fl_Tree_Item *item=0, int docallback=1); int extend_selection_dir(Fl_Tree_Item *from, Fl_Tree_Item *to, int dir, int val, bool visible); int extend_selection(Fl_Tree_Item *from, Fl_Tree_Item *to, int val=1, bool visible=false); void set_item_focus(Fl_Tree_Item *item); Fl_Tree_Item *get_item_focus() const; int is_selected(Fl_Tree_Item *item) const; int is_selected(const char *path); ///////////////////////////////// // Item attribute related methods ///////////////////////////////// Fl_Font item_labelfont() const; void item_labelfont(Fl_Font val); Fl_Fontsize item_labelsize() const; void item_labelsize(Fl_Fontsize val); Fl_Color item_labelfgcolor(void) const; void item_labelfgcolor(Fl_Color val); Fl_Color item_labelbgcolor(void) const; void item_labelbgcolor(Fl_Color val); Fl_Color connectorcolor() const; void connectorcolor(Fl_Color val); int marginleft() const; void marginleft(int val); int margintop() const; void margintop(int val); int marginbottom() const; void marginbottom(int val); int linespacing() const; void linespacing(int val); int openchild_marginbottom() const; void openchild_marginbottom(int val); int usericonmarginleft() const; void usericonmarginleft(int val); int labelmarginleft() const; void labelmarginleft(int val); int widgetmarginleft() const; void widgetmarginleft(int val); int connectorwidth() const; void connectorwidth(int val); Fl_Image* usericon() const; void usericon(Fl_Image *val); Fl_Image* openicon() const; void openicon(Fl_Image *val); Fl_Image* closeicon() const; void closeicon(Fl_Image *val); int showcollapse() const; void showcollapse(int val); int showroot() const; void showroot(int val); Fl_Tree_Connector connectorstyle() const; void connectorstyle(Fl_Tree_Connector val); Fl_Tree_Sort sortorder() const; void sortorder(Fl_Tree_Sort val); Fl_Boxtype selectbox() const; void selectbox(Fl_Boxtype val); Fl_Tree_Select selectmode() const; void selectmode(Fl_Tree_Select val); Fl_Tree_Item_Reselect_Mode item_reselect_mode() const; void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode); Fl_Tree_Item_Draw_Mode item_draw_mode() const; void item_draw_mode(Fl_Tree_Item_Draw_Mode mode); void item_draw_mode(int mode); void calc_dimensions(); void calc_tree(); void recalc_tree(); int displayed(Fl_Tree_Item *item); void show_item(Fl_Tree_Item *item, int yoff); void show_item(Fl_Tree_Item *item); void show_item_top(Fl_Tree_Item *item); void show_item_middle(Fl_Tree_Item *item); void show_item_bottom(Fl_Tree_Item *item); void display(Fl_Tree_Item *item); int vposition() const; void vposition(int pos); int hposition() const; void hposition(int pos); int is_scrollbar(Fl_Widget *w); int scrollbar_size() const; void scrollbar_size(int size); int is_vscroll_visible() const; int is_hscroll_visible() const; /////////////////////// // callback related /////////////////////// void callback_item(Fl_Tree_Item* item); Fl_Tree_Item* callback_item(); void callback_reason(Fl_Tree_Reason reason); Fl_Tree_Reason callback_reason() const; /// Load FLTK preferences void load(class Fl_Preferences&); }; #endif /*FL_TREE_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Tree_Item.H ================================================ // #ifndef FL_TREE_ITEM_H #define FL_TREE_ITEM_H #include #include #include #include #include #include ////////////////////// // FL/Fl_Tree_Item.H ////////////////////// // // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK // Copyright (C) 2009-2010 by Greg Ercolano. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /// /// \file /// \brief This file contains the definitions for Fl_Tree_Item /// /// \class Fl_Tree_Item /// \brief Tree widget item. /// /// This class is a single tree item, and manages all of the item's attributes. /// Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item. /// /// Fl_Tree_Item is hierarchical; it dynamically manages an Fl_Tree_Item_Array of children /// that are themselves instances of Fl_Tree_Item. Each item can have zero or more children. /// When an item has children, close() and open() can be used to hide or show them. /// /// Items have their own attributes; font size, face, color. /// Items maintain their own hierarchy of children. /// /// When you make changes to items, you'll need to tell the tree to redraw() /// for the changes to show up. /// /// New 1.3.3 ABI feature: /// You can define custom items by either adding a custom widget to the item /// with Fl_Tree_Item::widget(), or override the draw_item_content() method /// if you want to just redefine how the label is drawn. /// /// The following shows the Fl_Tree_Item's dimensions, useful when overriding /// the draw_item_content() method: /// /// \image html Fl_Tree_Item-dimensions.png "Fl_Tree_Item's internal dimensions." width=6cm /// \image latex Fl_Tree_Item-dimensions.png "Fl_Tree_Item's internal dimensions." width=6cm /// class Fl_Tree; class FL_EXPORT Fl_Tree_Item { Fl_Tree *_tree; // parent tree const char *_label; // label (memory managed) Fl_Font _labelfont; // label's font face Fl_Fontsize _labelsize; // label's font size Fl_Color _labelfgcolor; // label's fg color Fl_Color _labelbgcolor; // label's bg color (0xffffffff is 'transparent') /// \enum Fl_Tree_Item_Flags enum Fl_Tree_Item_Flags { OPEN = 1<<0, ///> item is open VISIBLE = 1<<1, ///> item is visible ACTIVE = 1<<2, ///> item is active SELECTED = 1<<3 ///> item is selected }; unsigned short _flags; // misc flags int _xywh[4]; // xywh of this widget (if visible) int _collapse_xywh[4]; // xywh of collapse icon (if visible) int _label_xywh[4]; // xywh of label Fl_Widget *_widget; // item's label widget (optional) Fl_Image *_usericon; // item's user-specific icon (optional) Fl_Image *_userdeicon; // deactivated usericon Fl_Tree_Item_Array _children; // array of child items Fl_Tree_Item *_parent; // parent item (=0 if root) void *_userdata; // user data that can be associated with an item Fl_Tree_Item *_prev_sibling; // previous sibling (same level) Fl_Tree_Item *_next_sibling; // next sibling (same level) // Protected methods protected: void _Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree); void show_widgets(); void hide_widgets(); void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs); void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs); void recalc_tree(); int calc_item_height(const Fl_Tree_Prefs &prefs) const; Fl_Color drawfgcolor() const; Fl_Color drawbgcolor() const; public: Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR -- backwards compatible Fl_Tree_Item(Fl_Tree *tree); // CTOR -- ABI 1.3.3+ virtual ~Fl_Tree_Item(); // DTOR -- ABI 1.3.3+ Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR /// The item's x position relative to the window int x() const { return(_xywh[0]); } /// The item's y position relative to the window int y() const { return(_xywh[1]); } /// The entire item's width to right edge of Fl_Tree's inner width /// within scrollbars. int w() const { return(_xywh[2]); } /// The item's height int h() const { return(_xywh[3]); } /// The item's label x position relative to the window /// \version 1.3.3 int label_x() const { return(_label_xywh[0]); } /// The item's label y position relative to the window /// \version 1.3.3 int label_y() const { return(_label_xywh[1]); } /// The item's maximum label width to right edge of Fl_Tree's inner width /// within scrollbars. /// \version 1.3.3 int label_w() const { return(_label_xywh[2]); } /// The item's label height /// \version 1.3.3 int label_h() const { return(_label_xywh[3]); } virtual int draw_item_content(int render); void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus, int &tree_item_xmax, int lastchild=1, int render=1); void show_self(const char *indent = "") const; void label(const char *val); const char *label() const; /// Set a user-data value for the item. inline void user_data( void* data ) { _userdata = data; } /// Retrieve the user-data value that has been assigned to the item. inline void* user_data() const { return _userdata; } /// Set item's label font face. void labelfont(Fl_Font val) { _labelfont = val; recalc_tree(); // may change tree geometry } /// Get item's label font face. Fl_Font labelfont() const { return(_labelfont); } /// Set item's label font size. void labelsize(Fl_Fontsize val) { _labelsize = val; recalc_tree(); // may change tree geometry } /// Get item's label font size. Fl_Fontsize labelsize() const { return(_labelsize); } /// Set item's label foreground text color. void labelfgcolor(Fl_Color val) { _labelfgcolor = val; } /// Return item's label foreground text color. Fl_Color labelfgcolor() const { return(_labelfgcolor); } /// Set item's label text color. Alias for labelfgcolor(Fl_Color)). void labelcolor(Fl_Color val) { labelfgcolor(val); } /// Return item's label text color. Alias for labelfgcolor() const). Fl_Color labelcolor() const { return labelfgcolor(); } /// Set item's label background color. /// A special case is made for color 0xffffffff which uses the parent tree's bg color. void labelbgcolor(Fl_Color val) { _labelbgcolor = val; } /// Return item's label background text color. /// If the color is 0xffffffff, the default behavior is the parent tree's /// bg color will be used. (An overloaded draw_item_content() can override /// this behavior.) Fl_Color labelbgcolor() const { return(_labelbgcolor); } /// Assign an FLTK widget to this item. void widget(Fl_Widget *val) { _widget = val; recalc_tree(); // may change tree geometry } /// Return FLTK widget assigned to this item. Fl_Widget *widget() const { return(_widget); } /// Return the number of children this item has. int children() const { return(_children.total()); } /// Return the child item for the given 'index'. Fl_Tree_Item *child(int index) { return(_children[index]); } /// Return the const child item for the given 'index'. const Fl_Tree_Item *child(int t) const; /// See if this item has children. int has_children() const { return(children()); } int find_child(const char *name); int find_child(Fl_Tree_Item *item); int remove_child(Fl_Tree_Item *item); int remove_child(const char *new_label); void clear_children(); void swap_children(int ax, int bx); int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b); const Fl_Tree_Item *find_child_item(const char *name) const; Fl_Tree_Item *find_child_item(const char *name); const Fl_Tree_Item *find_child_item(char **arr) const; Fl_Tree_Item *find_child_item(char **arr); const Fl_Tree_Item *find_item(char **arr) const; Fl_Tree_Item *find_item(char **arr); ////////////////// // Adding items ////////////////// Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, const char *new_label, Fl_Tree_Item *newitem); Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, const char *new_label); Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, char **arr, Fl_Tree_Item *newitem); Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, char **arr); Fl_Tree_Item *replace(Fl_Tree_Item *new_item); Fl_Tree_Item *replace_child(Fl_Tree_Item *olditem, Fl_Tree_Item *newitem); Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0); Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label); Fl_Tree_Item* deparent(int index); int reparent(Fl_Tree_Item *newchild, int index); int move(int to, int from); int move(Fl_Tree_Item *item, int op=0, int pos=0); int move_above(Fl_Tree_Item *item); int move_below(Fl_Tree_Item *item); int move_into(Fl_Tree_Item *item, int pos=0); int depth() const; Fl_Tree_Item *prev(); Fl_Tree_Item *next(); Fl_Tree_Item *next_sibling(); Fl_Tree_Item *prev_sibling(); void update_prev_next(int index); Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs); // deprecated Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs); // deprecated Fl_Tree_Item *next_visible(Fl_Tree_Prefs &prefs); Fl_Tree_Item *prev_visible(Fl_Tree_Prefs &prefs); /// Return the parent for this item. Returns NULL if we are the root. Fl_Tree_Item *parent() { return(_parent); } /// Return the const parent for this item. Returns NULL if we are the root. const Fl_Tree_Item *parent() const { return(_parent); } /// Set the parent for this item. /// Should only be used by Fl_Tree's internals. /// void parent(Fl_Tree_Item *val) { _parent = val; } const Fl_Tree_Prefs& prefs() const; /// Return the tree for this item. /// \version 1.3.3 const Fl_Tree *tree() const { return(_tree); } /// Return the tree for this item. /// \version 1.3.4 Fl_Tree *tree() { return(_tree); } ////////////////// // State ////////////////// void open(); void close(); /// See if the item is 'open'. int is_open() const { return(is_flag(OPEN)); } /// See if the item is 'closed'. int is_close() const { return(is_flag(OPEN)?0:1); } /// Toggle the item's open/closed state. void open_toggle() { is_open()?close():open(); // handles calling recalc_tree() } /// Change the item's selection state to the optionally specified 'val'. /// If 'val' is not specified, the item will be selected. /// void select(int val=1) { set_flag(SELECTED, val); } /// Toggle the item's selection state. void select_toggle() { if ( is_selected() ) { deselect(); // deselect if selected } else { select(); // select if deselected } } /// Select item and all its children. /// Returns count of how many items were in the 'deselected' state, /// ie. how many items were "changed". /// int select_all() { int count = 0; if ( ! is_selected() ) { select(); ++count; } for ( int t=0; tselect_all(); } return(count); } /// Disable the item's selection state. void deselect() { set_flag(SELECTED, 0); } /// Deselect item and all its children. /// Returns count of how many items were in the 'selected' state, /// ie. how many items were "changed". /// int deselect_all() { int count = 0; if ( is_selected() ) { deselect(); ++count; } for ( int t=0; tdeselect_all(); } return(count); } /// See if the item is selected. char is_selected() const { return(is_flag(SELECTED)); } /// Change the item's activation state to the optionally specified 'val'. /// /// When deactivated, the item will be 'grayed out'; the callback() /// won't be invoked if the user clicks on the label. If a widget() /// is associated with the item, its activation state will be changed as well. /// /// If 'val' is not specified, the item will be activated. /// void activate(int val=1) { set_flag(ACTIVE,val); if ( _widget && val != (int)_widget->active() ) { if ( val ) { _widget->activate(); } else { _widget->deactivate(); } _widget->redraw(); } } /// Deactivate the item; the callback() won't be invoked when clicked. /// Same as activate(0) /// void deactivate() { activate(0); } /// See if the item is activated. char is_activated() const { return(is_flag(ACTIVE)); } /// See if the item is activated. Alias for is_activated(). char is_active() const { return(is_activated()); } /// See if the item is visible. Alias for is_visible(). int visible() const { return(is_visible()); } /// See if the item is visible. int is_visible() const { return(is_flag(VISIBLE)); } /// See if item and all its parents are open() and visible(). /// Alias for is_visible_r(). /// \returns /// 1 -- item and its parents are open() and visible() /// 0 -- item (or one of its parents) are not visible or close()ed. /// int visible_r() const { return(is_visible_r()); } int is_visible_r() const; /// Set the item's user icon to an Fl_Image. Use '0' to disable. /// No internal copy is made, caller must manage icon's memory. /// /// Note, if you expect your items to be deactivated(), /// use userdeicon(Fl_Image*) to set up a 'grayed out' version of your icon /// to be used for display. /// /// \see userdeicon(Fl_Image*) /// void usericon(Fl_Image *val) { _usericon = val; recalc_tree(); // may change tree geometry } /// Get the item's user icon as an Fl_Image. Returns '0' if disabled. Fl_Image *usericon() const { return(_usericon); } /// Set the usericon to draw when the item is deactivated. Use '0' to disable. /// No internal copy is made; caller must manage icon's memory. /// /// To create a typical 'grayed out' version of your usericon image, /// you can do the following: /// /// \code /// // Create tree + usericon for items /// Fl_Tree *tree = new Fl_Tree(..); /// Fl_Image *usr_icon = new Fl_Pixmap(..); // your usericon /// Fl_Image *de_icon = usr_icon->copy(); // make a copy, and.. /// de_icon->inactive(); // make it 'grayed out' /// ... /// for ( .. ) { // item loop.. /// item = tree->add("..."); // create new item /// item->usericon(usr_icon); // assign usericon to items /// item->userdeicon(de_icon); // assign userdeicon to items /// .. /// } /// \endcode /// /// In the above example, the app should 'delete' the two icons /// when they're no longer needed (e.g. after the tree is destroyed) /// /// \version 1.3.4 /// void userdeicon(Fl_Image* val) { _userdeicon = val; } /// Return the deactivated version of the user icon, if any. /// Returns 0 if none. Fl_Image* userdeicon() const { return _userdeicon; } ////////////////// // Events ////////////////// const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0) const; Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0); int event_on_item(const Fl_Tree_Prefs &prefs) const; int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const; int event_on_user_icon(const Fl_Tree_Prefs &prefs) const; int event_on_label(const Fl_Tree_Prefs &prefs) const; /// Is this item the root of the tree? int is_root() const { return(_parent==0?1:0); } // Protected methods // TODO: move these to top 'protected:' section protected: /// Set a flag to an on or off value. val is 0 or 1. inline void set_flag(unsigned short flag,int val) { if ( flag==OPEN || flag==VISIBLE ) { recalc_tree(); // may change tree geometry } if ( val ) _flags |= flag; else _flags &= ~flag; } /// See if flag set. Returns 0 or 1. inline int is_flag(unsigned short val) const { return(_flags & val ? 1 : 0); } }; #endif /*FL_TREE_ITEM_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Tree_Item_Array.H ================================================ // #ifndef _FL_TREE_ITEM_ARRAY_H #define _FL_TREE_ITEM_ARRAY_H #include #include "Fl_Export.H" class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block // or doxygen will not document our class.. ////////////////////////// // FL/Fl_Tree_Item_Array.H ////////////////////////// // // Fl_Tree -- This file is part of the Fl_Tree widget for FLTK // Copyright (C) 2009-2010 by Greg Ercolano. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /// /// \file /// \brief This file defines a class that manages an array of Fl_Tree_Item pointers. /// /// \brief Manages an array of Fl_Tree_Item pointers. /// /// Because FLTK 1.x.x. has mandated that templates and STL not be used, /// we use this class to dynamically manage the arrays. /// /// None of the methods do range checking on index values; the caller /// must be sure that index values are within the range 0 manage the Fl_Tree_Item's internals (internal use only) }; char _flags; // flags to control behavior void enlarge(int count); public: Fl_Tree_Item_Array(int new_chunksize = 10); // CTOR ~Fl_Tree_Item_Array(); // DTOR Fl_Tree_Item_Array(const Fl_Tree_Item_Array *o); // COPY CTOR /// Return the item and index \p i. Fl_Tree_Item *operator[](int i) { return(_items[i]); } /// Const version of operator[](int i) const Fl_Tree_Item *operator[](int i) const { return(_items[i]); } /// Return the total items in the array, or 0 if empty. int total() const { return(_total); } /// Swap the two items at index positions \p ax and \p bx. void swap(int ax, int bx); int move(int to, int from); int deparent(int pos); int reparent(Fl_Tree_Item *item, Fl_Tree_Item *newparent, int pos); void clear(); void add(Fl_Tree_Item *val); void insert(int pos, Fl_Tree_Item *new_item); void replace(int pos, Fl_Tree_Item *new_item); void remove(int index); int remove(Fl_Tree_Item *item); /// Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's. /// If set: items and item array is destroyed. /// If clear: only the item array is destroyed, not items themselves. void manage_item_destroy(int val) { if ( val ) _flags |= MANAGE_ITEM; else _flags &= ~MANAGE_ITEM; } int manage_item_destroy() const { return _flags & MANAGE_ITEM ? 1 : 0; } }; #endif /*_FL_TREE_ITEM_ARRAY_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Tree_Prefs.H ================================================ // #ifndef FL_TREE_PREFS_H #define FL_TREE_PREFS_H #include // needed for ABI version features (via Enumerations.H) ////////////////////// // FL/Fl_Tree_Prefs.H ////////////////////// // // Fl_Tree_Prefs -- This file is part of the Fl_Tree widget for FLTK // Copyright (C) 2009-2010 by Greg Ercolano. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /// /// \file /// \brief This file contains the definitions for Fl_Tree's preferences. /// /// \code /// Fl_Tree_Prefs /// : /// .....:....... /// : : /// Fl_Tree : /// |_____ Fl_Tree_Item /// /// \endcode /// /// \class Fl_Tree_Prefs /// \brief Tree widget's preferences. /// \enum Fl_Tree_Sort /// Sort order options for items added to the tree /// enum Fl_Tree_Sort { FL_TREE_SORT_NONE=0, ///< No sorting; items are added in the order defined (default). FL_TREE_SORT_ASCENDING=1, ///< Add items in ascending sort order. FL_TREE_SORT_DESCENDING=2 ///< Add items in descending sort order. }; /// \enum Fl_Tree_Connector /// Defines the style of connection lines between items. /// enum Fl_Tree_Connector { FL_TREE_CONNECTOR_NONE=0, ///< Use no lines connecting items FL_TREE_CONNECTOR_DOTTED=1, ///< Use dotted lines connecting items (default) FL_TREE_CONNECTOR_SOLID=2 ///< Use solid lines connecting items }; /// \enum Fl_Tree_Select /// Tree selection style. /// enum Fl_Tree_Select { FL_TREE_SELECT_NONE=0, ///< Nothing selected when items are clicked FL_TREE_SELECT_SINGLE=1, ///< Single item selected when item is clicked (default) FL_TREE_SELECT_MULTI=2, ///< Multiple items can be selected by clicking ///< with SHIFT, CTRL or mouse drags. FL_TREE_SELECT_SINGLE_DRAGGABLE=3 ///< Single items may be selected, and they may be ///< reordered by mouse drag. }; /// \enum Fl_Tree_Item_Reselect_Mode /// Defines the ways an item can be (re) selected /// via item_reselect_mode(). /// enum Fl_Tree_Item_Reselect_Mode { FL_TREE_SELECTABLE_ONCE=0, ///< Item can only be selected once (default) FL_TREE_SELECTABLE_ALWAYS ///< Enables FL_TREE_REASON_RESELECTED events for callbacks }; /// \enum Fl_Tree_Item_Draw_Mode /// Bit flags that control how item's labels and widget()s are drawn in the tree /// via item_draw_mode(). /// enum Fl_Tree_Item_Draw_Mode { FL_TREE_ITEM_DRAW_DEFAULT=0, ///< If widget() defined, draw in place of label, ///< and widget() tracks item height (default) FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET=1, ///< If widget() defined, include label to the left of the widget FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2 ///< If widget() defined, widget()'s height controls item's height }; class Fl_Tree_Item; typedef void (Fl_Tree_Item_Draw_Callback)(Fl_Tree_Item*, void*); /// \class Fl_Tree_Prefs /// /// \brief Fl_Tree's Preferences class. /// /// This class manages the Fl_Tree's defaults. /// You should probably be using the methods in Fl_Tree /// instead of trying to accessing tree's preferences settings directly. /// class FL_EXPORT Fl_Tree_Prefs { Fl_Font _labelfont; // label's font face Fl_Fontsize _labelsize; // label's font size int _margintop; // -- int _marginleft; // |- tree's controllable margins int _marginbottom; // -- int _openchild_marginbottom; // extra space below an open child tree int _usericonmarginleft; // space to left of user icon (if any) int _labelmarginleft; // space to left of label int _widgetmarginleft; // space to left of widget int _connectorwidth; // connector width (right of open/close icon) int _linespacing; // vertical space between lines // Colors Fl_Color _labelfgcolor; // label's foreground color Fl_Color _labelbgcolor; // label's background color Fl_Color _connectorcolor; // connector dotted line color Fl_Tree_Connector _connectorstyle; // connector line style Fl_Image *_openimage; // the 'open' icon [+] Fl_Image *_closeimage; // the 'close' icon [-] Fl_Image *_userimage; // user's own icon Fl_Image *_opendeimage; // deactivated 'open' icon Fl_Image *_closedeimage; // deactivated 'close' icon Fl_Image *_userdeimage; // deactivated user icon char _showcollapse; // 1=show collapse icons, 0=don't char _showroot; // show the root item as part of the tree Fl_Tree_Sort _sortorder; // none, ascening, descending, etc. Fl_Boxtype _selectbox; // selection box type Fl_Tree_Select _selectmode; // selection mode Fl_Tree_Item_Reselect_Mode _itemreselectmode; // controls item selection callback() behavior Fl_Tree_Item_Draw_Mode _itemdrawmode; // controls how items draw label + widget() Fl_Tree_Item_Draw_Callback *_itemdrawcallback; // callback to handle drawing items (0=none) void *_itemdrawuserdata; // data for drawing items (0=none) public: Fl_Tree_Prefs(); ~Fl_Tree_Prefs(); //////////////////////////// // Labels //////////////////////////// /// Return the label's font. inline Fl_Font item_labelfont() const { return(_labelfont); } /// Set the label's font to \p val. inline void item_labelfont(Fl_Font val) { _labelfont = val; } /// Return the label's size in pixels. inline Fl_Fontsize item_labelsize() const { return(_labelsize); } /// Set the label's size in pixels to \p val. inline void item_labelsize(Fl_Fontsize val) { _labelsize = val; } /// Get the default label foreground color inline Fl_Color item_labelfgcolor() const { return(_labelfgcolor); } /// Set the default label foreground color inline void item_labelfgcolor(Fl_Color val) { _labelfgcolor = val; } /// Get the default label background color. /// This returns the Fl_Tree::color() unless item_labelbgcolor() /// has been set explicitly. /// inline Fl_Color item_labelbgcolor() const { return _labelbgcolor; } /// Set the default label background color. /// Once set, overrides the default behavior of using Fl_Tree::color(). /// inline void item_labelbgcolor(Fl_Color val) { _labelbgcolor = val; } ///////////////// // Obsolete names - for 1.3.0 backwards compat ///////////////// /// Obsolete: Return the label's font. Please use item_labelfont() instead. inline Fl_Font labelfont() const { return(_labelfont); } /// Obsolete: Set the label's font to \p val. Please use item_labelfont(Fl_Font) instead. inline void labelfont(Fl_Font val) { _labelfont = val; } /// Obsolete: Return the label's size in pixels. Please use item_labelsize() instead. inline Fl_Fontsize labelsize() const { return(_labelsize); } /// Obsolete: Set the label's size in pixels to \p val. Please use item_labelsize(Fl_Fontsize) instead. inline void labelsize(Fl_Fontsize val) { _labelsize = val; } /// Obsolete: Get the default label foreground color. Please use item_labelfgcolor() instead. inline Fl_Color labelfgcolor() const { return(_labelfgcolor); } /// Obsolete: Set the default label foreground color. Please use item_labelfgcolor(Fl_Color) instead. inline void labelfgcolor(Fl_Color val) { _labelfgcolor = val; } /// Obsolete: Get the default label background color. Please use item_labelbgcolor() instead. inline Fl_Color labelbgcolor() const { return(item_labelbgcolor()); } /// Obsolete: Set the default label background color. Please use item_labelbgcolor(Fl_Color) instead. inline void labelbgcolor(Fl_Color val) { item_labelbgcolor(val); } //////////////////////////// // Margins //////////////////////////// /// Get the left margin's value in pixels inline int marginleft() const { return(_marginleft); } /// Set the left margin's value in pixels inline void marginleft(int val) { _marginleft = val; } /// Get the top margin's value in pixels inline int margintop() const { return(_margintop); } /// Set the top margin's value in pixels inline void margintop(int val) { _margintop = val; } /// Get the bottom margin's value in pixels. /// This is the extra distance the vertical scroller lets you travel. inline int marginbottom() const { return(_marginbottom); } /// Set the bottom margin's value in pixels /// This is the extra distance the vertical scroller lets you travel. inline void marginbottom(int val) { _marginbottom = val; } /// Get the margin below an open child in pixels inline int openchild_marginbottom() const { return(_openchild_marginbottom); } /// Set the margin below an open child in pixels inline void openchild_marginbottom(int val) { _openchild_marginbottom = val; } /// Get the user icon's left margin value in pixels inline int usericonmarginleft() const { return(_usericonmarginleft); } /// Set the user icon's left margin value in pixels inline void usericonmarginleft(int val) { _usericonmarginleft = val; } /// Get the label's left margin value in pixels inline int labelmarginleft() const { return(_labelmarginleft); } /// Set the label's left margin value in pixels inline void labelmarginleft(int val) { _labelmarginleft = val; } /// Get the widget()'s left margin value in pixels inline int widgetmarginleft() const { return(_widgetmarginleft); } /// Set the widget's left margin value in pixels inline void widgetmarginleft(int val) { _widgetmarginleft = val; } /// Get the line spacing value in pixels inline int linespacing() const { return(_linespacing); } /// Set the line spacing value in pixels inline void linespacing(int val) { _linespacing = val; } //////////////////////////// // Colors and Styles //////////////////////////// /// Get the connector color used for tree connection lines. inline Fl_Color connectorcolor() const { return(_connectorcolor); } /// Set the connector color used for tree connection lines. inline void connectorcolor(Fl_Color val) { _connectorcolor = val; } /// Get the connector style. inline Fl_Tree_Connector connectorstyle() const { return(_connectorstyle); } /// Set the connector style. inline void connectorstyle(Fl_Tree_Connector val) { _connectorstyle = val; } /// Set the connector style [integer]. inline void connectorstyle(int val) { _connectorstyle = Fl_Tree_Connector(val); } /// Get the tree connection line's width. inline int connectorwidth() const { return(_connectorwidth); } /// Set the tree connection line's width. inline void connectorwidth(int val) { _connectorwidth = val; } //////////////////////////// // Icons //////////////////////////// /// Get the current default 'open' icon. /// Returns the Fl_Image* of the icon, or 0 if none. /// inline Fl_Image *openicon() const { return(_openimage); } inline int openicon_w() const { return _openimage ? _openimage->w() : 11; } inline int openicon_h() const { return _openimage ? _openimage->h() : 11; } void openicon(Fl_Image *val); /// Gets the default 'close' icon /// Returns the Fl_Image* of the icon, or 0 if none. /// inline Fl_Image *closeicon() const { return(_closeimage); } inline int closeicon_w() const { return _closeimage ? _closeimage->w() : 11; } inline int closeicon_h() const { return _closeimage ? _closeimage->h() : 11; } void closeicon(Fl_Image *val); /// Gets the default 'user icon' (default is 0) inline Fl_Image *usericon() const { return(_userimage); } /// Sets the default 'user icon' /// Returns the Fl_Image* of the icon, or 0 if none (default). /// inline void usericon(Fl_Image *val) { _userimage = val; // Update deactivated version of icon.. if ( _userdeimage ) delete _userdeimage; if ( _userimage ) { _userdeimage = _userimage->copy(); _userdeimage->inactive(); } else { _userdeimage = 0; } } /// Return the deactivated version of the open icon, if any. /// Returns 0 if none. inline Fl_Image *opendeicon() const { return _opendeimage; } /// Return the deactivated version of the close icon, if any. /// Returns 0 if none. inline Fl_Image *closedeicon() const { return _closedeimage; } /// Return the deactivated version of the user icon, if any. /// Returns 0 if none. inline Fl_Image *userdeicon() const { return _userdeimage; } //////////////////////////// // Options //////////////////////////// /// Returns 1 if the collapse icon is enabled, 0 if not. inline char showcollapse() const { return(_showcollapse); } /// Set if we should show the collapse icon or not. /// If collapse icons are disabled, the user will not be able /// to interactively collapse items in the tree, unless the application /// provides some other means via open() and close(). /// /// \param[in] val 1: shows collapse icons (default),\n /// 0: hides collapse icons. /// inline void showcollapse(int val) { _showcollapse = val; } /// Get the default sort order value inline Fl_Tree_Sort sortorder() const { return(_sortorder); } /// Set the default sort order value. /// Defines the order new items appear when add()ed to the tree. /// See Fl_Tree_Sort for possible values. /// inline void sortorder(Fl_Tree_Sort val) { _sortorder = val; } /// Get the default selection box's box drawing style as an Fl_Boxtype. inline Fl_Boxtype selectbox() const { return(_selectbox); } /// Set the default selection box's box drawing style to \p val. inline void selectbox(Fl_Boxtype val) { _selectbox = val; } /// Returns 1 if the root item is to be shown, or 0 if not. inline int showroot() const { return(int(_showroot)); } /// Set if the root item should be shown or not. /// \param[in] val 1 -- show the root item (default)\n /// 0 -- hide the root item. /// inline void showroot(int val) { _showroot = char(val); } /// Get the selection mode used for the tree inline Fl_Tree_Select selectmode() const { return(_selectmode); } /// Set the selection mode used for the tree to \p val. /// This affects how items in the tree are selected /// when clicked on and dragged over by the mouse. /// See Fl_Tree_Select for possible values. /// inline void selectmode(Fl_Tree_Select val) { _selectmode = val; } /// Returns the current item re/selection mode Fl_Tree_Item_Reselect_Mode item_reselect_mode() const { return _itemreselectmode; } /// Sets the item re/selection mode void item_reselect_mode(Fl_Tree_Item_Reselect_Mode mode) { _itemreselectmode = mode; } /// Get the 'item draw mode' used for the tree inline Fl_Tree_Item_Draw_Mode item_draw_mode() const { return(_itemdrawmode); } /// Set the 'item draw mode' used for the tree to \p val. /// This affects how items in the tree are drawn, /// such as when a widget() is defined. /// See Fl_Tree_Item_Draw_Mode for possible values. /// inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) { _itemdrawmode = val; } void item_draw_callback(Fl_Tree_Item_Draw_Callback *cb, void *data=0) { _itemdrawcallback = cb; _itemdrawuserdata = data; } Fl_Tree_Item_Draw_Callback* item_draw_callback() const { return(_itemdrawcallback); } void* item_draw_user_data() const { return(_itemdrawuserdata); } void do_item_draw_callback(Fl_Tree_Item *o) const { _itemdrawcallback(o, _itemdrawuserdata); } }; #endif /*FL_TREE_PREFS_H*/ ================================================ FILE: Game Trainers/common/include/FL/Fl_Valuator.H ================================================ // // Valuator header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Valuator widget . */ #ifndef Fl_Valuator_H #define Fl_Valuator_H #ifndef Fl_Widget_H #include "Fl_Widget.H" #endif // shared type() values for classes that work in both directions: #define FL_VERTICAL 0 ///< The valuator can work vertically #define FL_HORIZONTAL 1 ///< The valuator can work horizontally /** The Fl_Valuator class controls a single floating-point value and provides a consistent interface to set the value, range, and step, and insures that callbacks are done the same for every object. There are probably more of these classes in FLTK than any others: \image html valuators.png \image latex valuators.png "Valuators derived from Fl_Valuators" width=10cm In the above diagram each box surrounds an actual subclass. These are further differentiated by setting the type() of the widget to the symbolic value labeling the widget. The ones labelled "0" are the default versions with a type(0). For consistency the symbol FL_VERTICAL is defined as zero. */ class FL_EXPORT Fl_Valuator : public Fl_Widget { double value_; double previous_value_; double min, max; // truncates to this range *after* rounding double A; int B; // rounds to multiples of A/B, or no rounding if A is zero protected: /** Tells if the valuator is an FL_HORIZONTAL one */ int horizontal() const {return type()& FL_HORIZONTAL;} Fl_Valuator(int X, int Y, int W, int H, const char* L); /** Gets the previous floating point value before an event changed it */ double previous_value() const {return previous_value_;} /** Stores the current value in the previous value */ void handle_push() {previous_value_ = value_;} double softclamp(double); void handle_drag(double newvalue); void handle_release(); // use drag() value virtual void value_damage(); // cause damage() due to value() changing /** Sets the current floating point value. */ void set_value(double v) {value_ = v;} public: /** Destructor is accessible despite protected constructor. */ ~Fl_Valuator() FL_OVERRIDE { } /** Sets the minimum (a) and maximum (b) values for the valuator widget. */ void bounds(double a, double b) {min=a; max=b;} /** Gets the minimum value for the valuator. */ double minimum() const {return min;} /** Sets the minimum value for the valuator. */ void minimum(double a) {min = a;} /** Gets the maximum value for the valuator. */ double maximum() const {return max;} /** Sets the maximum value for the valuator. */ void maximum(double a) {max = a;} /** Sets the minimum and maximum values for the valuator. When the user manipulates the widget, the value is limited to this range. This clamping is done after rounding to the step value (this makes a difference if the range is not a multiple of the step). The minimum may be greater than the maximum. This has the effect of "reversing" the object so the larger values are in the opposite direction. This also switches which end of the filled sliders is filled. Some widgets consider this a "soft" range. This means they will stop at the range, but if the user releases and grabs the control again and tries to move it further, it is allowed. The range may affect the display. You must redraw() the widget after changing the range. */ void range(double a, double b) {min = a; max = b;} /** See double Fl_Valuator::step() const */ void step(int a) {A = a; B = 1;} /** See double Fl_Valuator::step() const */ void step(double a, int b) {A = a; B = b;} void step(double s); /** Gets or sets the step value. As the user moves the mouse the value is rounded to the nearest multiple of the step value. This is done \e before clamping it to the range. For most widgets the default step is zero. For precision the step is stored as the ratio of a double \p A and an integer \p B = A/B. You can set these values directly. Currently setting a floating point value sets the nearest A/1 or 1/B value possible. */ double step() const {return A/B;} void precision(int digits); /** Gets the floating point(double) value. See int value(double) */ double value() const {return value_;} int value(double); virtual int format(char*); double round(double); // round to nearest multiple of step double clamp(double); // keep in range double increment(double, int); // add n*step to value }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Value_Input.H ================================================ // // Value input header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Value_Input widget . */ #ifndef Fl_Value_Input_H #define Fl_Value_Input_H #include "Fl_Valuator.H" #include "Fl_Input.H" /** The Fl_Value_Input widget displays a numeric value. The user can click in the text field and edit it - there is in fact a hidden Fl_Input widget with type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in there - and when they hit return or tab the value updates to what they typed and the callback is done.

    If step() is non-zero and integral, then the range of numbers is limited to integers instead of floating point numbers. As well as displaying the value as an integer, typed input is also limited to integer values, even if the hidden Fl_Input widget is of type(FL_FLOAT_INPUT).

    If step() is non-zero, the user can also drag the mouse across the object and thus slide the value. The left button moves one step() per pixel, the middle by 10 * step(), and the right button by 100 * step(). It is therefore impossible to select text by dragging across it, although clicking can still move the insertion cursor.

    If step() is non-zero and integral, then the range of numbers are limited to integers instead of floating point values. \image html Fl_Value_Input.png \image latex Fl_Value_Input.png "Fl_Value_Input" width=4cm \see Fl_Widget::shortcut_label(int) */ class FL_EXPORT Fl_Value_Input : public Fl_Valuator { public: /* This is the encapsulated Fl_input attribute to which this class delegates the value font, color and shortcut */ Fl_Input input; private: char soft_; static void input_cb(Fl_Widget*,void*); void value_damage() FL_OVERRIDE; // cause damage() due to value() changing public: int handle(int) FL_OVERRIDE; protected: void draw() FL_OVERRIDE; public: void resize(int,int,int,int) FL_OVERRIDE; Fl_Value_Input(int x,int y,int w,int h,const char *l=0); ~Fl_Value_Input(); /** See void Fl_Value_Input::soft(char s) */ void soft(char s) {soft_ = s;} /** If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. The default is true. */ char soft() const {return soft_;} /** Returns the current shortcut key for the Input. \see Fl_Value_Input::shortcut(int) */ int shortcut() const {return input.shortcut();} /** Sets the shortcut key to \p s. Setting this overrides the use of '&' in the label(). The value is a bitwise OR of a key and a set of shift flags, for example FL_ALT | 'a' , FL_ALT | (FL_F + 10), or just 'a'. A value of 0 disables the shortcut. The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down. The shift flags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift flags (zero for the other bits indicates a "don't care" setting). */ void shortcut(int s) {input.shortcut(s);} /** Gets the typeface of the text in the value box. */ Fl_Font textfont() const {return input.textfont();} /** Sets the typeface of the text in the value box. */ void textfont(Fl_Font s) {input.textfont(s);} /** Gets the size of the text in the value box. */ Fl_Fontsize textsize() const {return input.textsize();} /** Sets the size of the text in the value box. */ void textsize(Fl_Fontsize s) {input.textsize(s);} /** Gets the color of the text in the value box. */ Fl_Color textcolor() const {return input.textcolor();} /** Sets the color of the text in the value box.*/ void textcolor(Fl_Color n) {input.textcolor(n);} /** Gets the color of the text cursor. The text cursor is black by default. */ Fl_Color cursor_color() const {return input.cursor_color();} /** Sets the color of the text cursor. The text cursor is black by default. */ void cursor_color(Fl_Color n) {input.cursor_color(n);} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Value_Output.H ================================================ // // Value output header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Value_Output widget . */ #ifndef Fl_Value_Output_H #define Fl_Value_Output_H #ifndef Fl_Valuator_H #include "Fl_Valuator.H" #endif /** The Fl_Value_Output widget displays a floating point value. If step() is not zero, the user can adjust the value by dragging the mouse left and right. The left button moves one step() per pixel, the middle by 10 * step(), and the right button by 100 * step().

    This is much lighter-weight than Fl_Value_Input because it contains no text editing code or character buffer.

    \image html Fl_Value_Output.png \image latex Fl_Value_Output.png "Fl_Value_Output" width=4cm */ class FL_EXPORT Fl_Value_Output : public Fl_Valuator { Fl_Font textfont_; Fl_Fontsize textsize_; uchar soft_; Fl_Color textcolor_; protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Value_Output(int x,int y,int w,int h,const char *l=0); /** If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. */ void soft(uchar s) {soft_ = s;} /** If "soft" is turned on, the user is allowed to drag the value outside the range. If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. Default is one. */ uchar soft() const {return soft_;} /** Gets the typeface of the text in the value box. */ Fl_Font textfont() const {return textfont_;} /** Sets the typeface of the text in the value box. */ void textfont(Fl_Font s) {textfont_ = s;} /** Gets the size of the text in the value box. */ Fl_Fontsize textsize() const {return textsize_;} void textsize(Fl_Fontsize s) {textsize_ = s;} /** Sets the color of the text in the value box. */ Fl_Color textcolor() const {return textcolor_;} /** Gets the color of the text in the value box. */ void textcolor(Fl_Color s) {textcolor_ = s;} }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Value_Slider.H ================================================ // // Value Slider header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Value_Slider widget . */ #ifndef Fl_Value_Slider_H #define Fl_Value_Slider_H #include "Fl_Slider.H" /** The Fl_Value_Slider widget is a Fl_Slider widget with a box displaying the current value. \image html value_slider.png \image latex value_slider.png "Fl_Value_Slider" width=4cm */ class FL_EXPORT Fl_Value_Slider : public Fl_Slider { Fl_Font textfont_; Fl_Fontsize textsize_; Fl_Color textcolor_; short value_width_; short value_height_; protected: void draw() FL_OVERRIDE; public: int handle(int) FL_OVERRIDE; Fl_Value_Slider(int x, int y, int w, int h, const char *l = 0); /** Gets the typeface of the text in the value box. */ Fl_Font textfont() const { return textfont_; } /** Sets the typeface of the text in the value box. */ void textfont(Fl_Font s) { textfont_ = s; } /** Gets the size of the text in the value box. */ Fl_Fontsize textsize() const { return textsize_; } /** Sets the size of the text in the value box. */ void textsize(Fl_Fontsize s) { textsize_ = s; } /** Gets the color of the text in the value box. */ Fl_Color textcolor() const { return textcolor_; } /** Sets the color of the text in the value box. */ void textcolor(Fl_Color s) { textcolor_ = s; } /** Sets the width of the value box in pixels (horizontal mode only). Limited range checking is applied but drawing errors may occur if the size \p s is set too high or too low, particularly if the widget is resized (later). The programmer is responsible for setting sensible values and widget sizes. The default value set by the constructor is 35. \param[in] s new width of the value box \since 1.4.0 */ void value_width(int s) { if (s > w() - 10) s = w() - 10; if (s < 10) s = 10; value_width_ = (short)s; } /** Gets the width of the value box in pixels (horizontal mode only). \since 1.4.0 */ int value_width() const { return (value_width_); } /** Sets the height of the value box in pixels (vertical mode only). Limited range checking is applied but drawing errors may occur if the size \p s is set too high or too low, particularly if the widget is resized (later). The programmer is responsible for setting sensible values and widget sizes. The default value set by the constructor is 25. \param[in] s new height of the value box \since 1.4.0 */ void value_height(int s) { if (s > h() - 10) s = h() - 10; if (s < 10) s = 10; value_height_ = (short)s; } /** Gets the height of the value box in pixels (vertical mode only). \since 1.4.0 */ int value_height() const { return (value_height_); } }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Widget.H ================================================ // // Widget header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file FL/Fl_Widget.H \brief Fl_Widget and Fl_Label classes. */ #ifndef Fl_Widget_H #define Fl_Widget_H #include "Fl.H" class Fl_Widget; class Fl_Window; class Fl_Group; class Fl_Image; /** Default callback type definition for all fltk widgets (by far the most used) */ typedef void (Fl_Callback )(Fl_Widget*, void*); /** Default callback type pointer definition for all fltk widgets */ typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND /** One parameter callback type definition passing only the widget */ typedef void (Fl_Callback0)(Fl_Widget*); /** Callback type definition passing the widget and a long data value */ typedef void (Fl_Callback1)(Fl_Widget*, long); /** This struct stores all information for a text or mixed graphics label. \todo There is an aspiration that the Fl_Label type will become a widget by itself. That way we will be avoiding a lot of code duplication by handling labels in a similar fashion to widgets containing text. We also provide an easy interface for very complex labels, containing html or vector graphics. However, this re-factoring is not in place in this release. */ struct FL_EXPORT Fl_Label { /** label text */ const char* value; /** optional image for an active label */ Fl_Image* image; /** optional image for a deactivated label */ Fl_Image* deimage; /** label font used in text */ Fl_Font font; /** size of label font */ Fl_Fontsize size; /** text color */ Fl_Color color; /** alignment of label */ Fl_Align align_; /** type of label. \see Fl_Labeltype */ uchar type; /** Spacing between label and the horizontally aligned side of the widget. */ signed char h_margin_; /** Spacing between label and the vertically aligned side of the widget. */ signed char v_margin_; /** Spacing between an image and the label text */ uchar spacing; /** Draws the label aligned to the given box */ void draw(int,int,int,int, Fl_Align) const ; void measure(int &w, int &h) const ; }; /** A class prototype that allows for additional data in callbacks. Users can derive this class and pass objects of such derived classes to widget callbacks. Widgets can take ownership of the callback data, deleting the data when the widget itself is deleted. The destructor of this class is virtual, allowing for additional code to deallocate resources when the user data is deleted. \see FL_FUNCTION_CALLBACK_3, FL_METHOD_CALLBACK_1, FL_INLINE_CALLBACK_2 \see Fl_Widget::callback(Fl_Callback*, Fl_Callback_User_Data*, bool) \see Fl_Widget::user_data(Fl_Callback_User_Data*, bool) */ class FL_EXPORT Fl_Callback_User_Data { protected: Fl_Callback_User_Data() {} ///< Protected constructor public: virtual ~Fl_Callback_User_Data() { } ///< Destructor }; /** Fl_Widget is the base class for all widgets in FLTK. You can't create one of these because the constructor is not public. However you can subclass it. All "property" accessing methods, such as color(), parent(), or argument() are implemented as trivial inline functions and thus are as fast and small as accessing fields in a structure. Unless otherwise noted, the property setting methods such as color(n) or label(s) are also trivial inline functions, even if they change the widget's appearance. It is up to the user code to call redraw() after these. */ class FL_EXPORT Fl_Widget { friend class Fl_Group; Fl_Group* parent_; Fl_Callback* callback_; void* user_data_; int x_,y_,w_,h_; Fl_Label label_; unsigned int flags_; Fl_Color color_; Fl_Color color2_; uchar type_; uchar damage_; uchar box_; uchar when_; const char *tooltip_; /** unimplemented copy ctor */ Fl_Widget(const Fl_Widget &); /** unimplemented assignment operator */ Fl_Widget& operator=(const Fl_Widget &); protected: /** Creates a widget at the given position and size. The Fl_Widget is a protected constructor, but all derived widgets have a matching public constructor. It takes a value for x(), y(), w(), h(), and an optional value for label(). \param[in] x, y the position of the widget relative to the enclosing window \param[in] w, h size of the widget in pixels \param[in] label optional text for the widget label */ Fl_Widget(int x, int y, int w, int h, const char *label=0L); /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */ void x(int v) {x_ = v;} /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */ void y(int v) {y_ = v;} /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */ void w(int v) {w_ = v;} /** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */ void h(int v) {h_ = v;} /** Gets the widget flags mask */ unsigned int flags() const {return flags_;} /** Sets a flag in the flags mask */ void set_flag(unsigned int c) {flags_ |= c;} /** Clears a flag in the flags mask */ void clear_flag(unsigned int c) {flags_ &= ~c;} /** flags possible values enumeration. See activate(), output(), visible(), changed(), set_visible_focus() */ enum { INACTIVE = 1<<0, ///< the widget can't receive focus, and is disabled but potentially visible INVISIBLE = 1<<1, ///< the widget is not drawn, but can receive a few special events OUTPUT = 1<<2, ///< for output only NOBORDER = 1<<3, ///< don't draw a decoration (Fl_Window) FORCE_POSITION = 1<<4, ///< don't let the window manager position the window (Fl_Window) NON_MODAL = 1<<5, ///< this is a hovering toolbar window (Fl_Window) SHORTCUT_LABEL = 1<<6, ///< the label contains a shortcut we need to draw CHANGED = 1<<7, ///< the widget value changed OVERRIDE = 1<<8, ///< position window on top (Fl_Window) VISIBLE_FOCUS = 1<<9, ///< accepts keyboard focus navigation if the widget can have the focus COPIED_LABEL = 1<<10, ///< the widget label is internally copied, its destruction is handled by the widget CLIP_CHILDREN = 1<<11, ///< all drawing within this widget will be clipped (Fl_Group) MENU_WINDOW = 1<<12, ///< a temporary popup window, dismissed by clicking outside (Fl_Window) TOOLTIP_WINDOW = 1<<13, ///< a temporary popup, transparent to events, and dismissed easily (Fl_Window) MODAL = 1<<14, ///< a window blocking input to all other windows (Fl_Window) NO_OVERLAY = 1<<15, ///< window not using a hardware overlay plane (Fl_Menu_Window) GROUP_RELATIVE = 1<<16, ///< Reserved, not implemented. DO NOT USE. COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget FULLSCREEN = 1<<18, ///< a fullscreen window (Fl_Window) MAC_USE_ACCENTS_MENU = 1<<19, ///< On the macOS platform, pressing and holding a key on the keyboard opens an accented-character menu window (Fl_Input_, Fl_Text_Editor) NEEDS_KEYBOARD = 1<<20, ///< set on touch screen devices if a widget needs a keyboard when it gets the focus. Reserved, not yet used in 1.4.0. \see Fl_Widget::needs_keyboard() IMAGE_BOUND = 1<<21, ///< binding the image to the widget will transfer ownership, so that the widget will delete the image when it is no longer needed DEIMAGE_BOUND = 1<<22, ///< bind the inactive image to the widget, so the widget deletes the image when it is no longer needed AUTO_DELETE_USER_DATA = 1<<23, ///< automatically call `delete` on the user_data pointer when destroying this widget; if set, user_data must point to a class derived from the class Fl_Callback_User_Data MAXIMIZED = 1<<24, ///< a maximized Fl_Window POPUP = 1<<25, ///< popup window (i.e., positioned relatively to another mapped window) // Note to devs: add new FLTK core flags above this line (up to 1<<28). // Three more flags, reserved for user code USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions USERFLAG1 = 1<<31 ///< reserved for 3rd party extensions }; void draw_box() const; void draw_box(Fl_Boxtype t, Fl_Color c) const; void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const; void draw_backdrop() const; /** Draws a focus rectangle around the widget. This method uses the widget's boxtype and coordinates and its background color color(). \see Fl_Widget::draw_focus(Fl_Boxtype, int, int, int, int, Fl_Color) const */ void draw_focus() const { draw_focus(box(), x(), y(), w(), h(), color()); } /** Draws a focus rectangle around the widget. This method uses the given boxtype and coordinates and the widget's background color color(). \see Fl_Widget::draw_focus(Fl_Boxtype, int, int, int, int, Fl_Color) const */ void draw_focus(Fl_Boxtype t, int X, int Y, int W, int H) const { draw_focus(t, X, Y, W, H, color()); } // See documentation in Fl_Widget.cxx void draw_focus(Fl_Boxtype t, int x, int y, int w, int h, Fl_Color bg) const; void draw_label() const; void draw_label(int, int, int, int) const; public: /** Destroys the widget. Destroying single widgets is not very common. You almost always want to destroy the parent group instead, which will destroy all of the child widgets and groups in that group. \since FLTK 1.3, the widget's destructor removes the widget from its parent group, if it is member of a group. */ virtual ~Fl_Widget(); /** Draws the widget. Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead. Override this function to draw your own widgets. If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this: \code Fl_Widget *s = &scrollbar; // scrollbar is an embedded Fl_Scrollbar s->draw(); // calls Fl_Scrollbar::draw() \endcode */ virtual void draw() = 0; /** Handles the specified event. You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget. When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise. Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval. One exception to the rule in the previous paragraph is if you really want to \e override the behavior of the base class. This requires knowledge of the details of the inherited class. In rare cases you may want to return 1 from your handle() method although you don't really handle the event. The effect would be to \e filter event processing, for instance if you want to dismiss non-numeric characters (keypresses) in a numeric input widget. You may "ring the bell" or show another visual indication or drop the event silently. In such a case you must not call the handle() method of the base class and tell FLTK that you \e consumed the event by returning 1 even if you didn't \e do anything with it. \param[in] event the kind of event received \retval 0 if the event was not used or understood \retval 1 if the event was used and can be deleted \see Fl_Event */ virtual int handle(int event); /** Returns whether the current label was assigned with copy_label(). This can be useful for temporarily overwriting the widget's label and restoring it later. \retval 0 current label was assigned with label(). \retval 1 current label was assigned with copy_label(). */ int is_label_copied() const {return ((flags_ & COPIED_LABEL) ? 1 : 0);} /** Sets whether this widget needs a keyboard. Set this on touch screen devices if a widget needs a keyboard when it gets the focus. \note This flag can be set but is not yet \b used in FLTK 1.4.0. It is intended to be used in the future on real touch devices. \param[in] needs Set this to true or false \internal Needs implementations in screen driver methods: \see Fl::screen_driver()->request_keyboard(); \see Fl::screen_driver()->release_keyboard(); */ void needs_keyboard(bool needs) { if (needs) set_flag(NEEDS_KEYBOARD); else clear_flag(NEEDS_KEYBOARD); } /** Returns whether this widget needs a keyboard. \return true or false \see needs_keyboard(bool) */ bool needs_keyboard() const { return (flags_ & NEEDS_KEYBOARD); } /** Returns a pointer to the parent widget. Usually this is a Fl_Group or Fl_Window. \retval NULL if the widget has no parent \see Fl_Group::add(Fl_Widget*) */ Fl_Group* parent() const {return parent_;} /** Internal use only - "for hacks only". It is \em \b STRONGLY recommended not to use this method, because it short-circuits Fl_Group's normal widget adding and removing methods, if the widget is already a child widget of another Fl_Group. Use Fl_Group::add(Fl_Widget*) and/or Fl_Group::remove(Fl_Widget*) instead. */ void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add() /** Gets the widget type. Returns the widget type value, which gives some information about the derived widget class to which the object belongs. Noticeably, the condition type() >= FL_WINDOW indicates a widget is an Fl_Window or derived object. */ uchar type() const {return type_;} /** Sets the widget type. \see type() */ void type(uchar t) {type_ = t;} /** Gets the widget position in its window. \return the x position relative to the window */ int x() const {return x_;} /** Gets the widget position in its window. \return the y position relative to the window */ int y() const {return y_;} /** Gets the widget width. \return the width of the widget in pixels. */ int w() const {return w_;} /** Gets the widget height. \return the height of the widget in pixels. */ int h() const {return h_;} /** Changes the size or position of the widget. This is a virtual function so that the widget may implement its own handling of resizing. The default version does \e not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position. Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations. position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H). \param[in] x, y new position relative to the parent window \param[in] w, h new size \see position(int,int), size(int,int) */ virtual void resize(int x, int y, int w, int h); /** Internal use only. */ int damage_resize(int,int,int,int); /** Repositions the window or widget. position(X, Y) is a shortcut for resize(X, Y, w(), h()). \param[in] X, Y new position relative to the parent window \see resize(int,int,int,int), size(int,int) */ void position(int X,int Y) {resize(X,Y,w_,h_);} /** Changes the size of the widget. size(W, H) is a shortcut for resize(x(), y(), W, H). \param[in] W, H new size \see position(int,int), resize(int,int,int,int) */ void size(int W,int H) {resize(x_,y_,W,H);} /** Gets the label alignment. \return label alignment \see label(), align(Fl_Align), Fl_Align */ Fl_Align align() const {return label_.align_;} /** Sets the label alignment. This controls how the label is displayed next to or inside the widget. The default value is FL_ALIGN_CENTER, which centers the label inside the widget. \param[in] alignment new label alignment \see align(), Fl_Align */ void align(Fl_Align alignment) {label_.align_ = alignment;} /** Gets the box type of the widget. \return the current box type \see box(Fl_Boxtype), Fl_Boxtype */ Fl_Boxtype box() const {return (Fl_Boxtype)box_;} /** Sets the box type for the widget. This identifies a routine that draws the background of the widget. See Fl_Boxtype for the available types. The default depends on the widget, but is usually FL_NO_BOX or FL_UP_BOX. \param[in] new_box the new box type \see box(), Fl_Boxtype */ void box(Fl_Boxtype new_box) {box_ = new_box;} /** Gets the background color of the widget. \return current background color \see color(Fl_Color), color(Fl_Color, Fl_Color) */ Fl_Color color() const {return color_;} /** Sets the background color of the widget. The color is passed to the box routine. The color is either an index into an internal table of RGB colors or an RGB color value generated using fl_rgb_color(). The default for most widgets is FL_BACKGROUND_COLOR. Use Fl::set_color() to redefine colors in the color map. \param[in] bg background color \see color(), color(Fl_Color, Fl_Color), selection_color(Fl_Color) */ void color(Fl_Color bg) {color_ = bg;} /** Gets the selection color. \return the current selection color \see selection_color(Fl_Color), color(Fl_Color, Fl_Color) */ Fl_Color selection_color() const {return color2_;} /** Sets the selection color. The selection color is defined for Forms compatibility and is usually used to color the widget when it is selected, although some widgets use this color for other purposes. You can set both colors at once with color(Fl_Color bg, Fl_Color sel). \param[in] a the new selection color \see selection_color(), color(Fl_Color, Fl_Color) */ void selection_color(Fl_Color a) {color2_ = a;} /** Sets the background and selection color of the widget. The two color form sets both the background and selection colors. \param[in] bg background color \param[in] sel selection color \see color(unsigned), selection_color(unsigned) */ void color(Fl_Color bg, Fl_Color sel) {color_=bg; color2_=sel;} /** Gets the current label text. \return a pointer to the current label text \see label(const char *), copy_label(const char *) */ const char* label() const {return label_.value;} /** Sets the current label pointer. The label is shown somewhere on or next to the widget. See \ref common_labels for details about what can be put in a label. The passed pointer is stored unchanged in the widget (the string is \em not copied), so if you need to set the label to a formatted value, make sure the buffer is static, global, or allocated. The copy_label() method can be used to make a copy of the label string automatically. \param[in] text pointer to new label text \see copy_label() */ void label(const char* text); /** Sets the current label. Unlike label(), this method allocates a copy of the label string instead of using the original string pointer. The internal copy will automatically be freed whenever you assign a new label or when the widget is destroyed. \param[in] new_label the new label text \see label() */ void copy_label(const char *new_label); /** Shortcut to set the label text and type in one call. \see label(const char *), labeltype(Fl_Labeltype) */ void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;} /** Gets the label type. \return the current label type. \see Fl_Labeltype */ Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;} /** Sets the label type. The label type identifies the function that draws the label of the widget. This is generally used for special effects such as embossing or for using the label() pointer as another form of data such as an icon. The value FL_NORMAL_LABEL prints the label as plain text. \param[in] a new label type \see Fl_Labeltype */ void labeltype(Fl_Labeltype a) {label_.type = a;} /** Gets the label color. The default color is FL_FOREGROUND_COLOR. \return the current label color */ Fl_Color labelcolor() const {return label_.color;} /** Sets the label color. The default color is FL_FOREGROUND_COLOR. \param[in] c the new label color */ void labelcolor(Fl_Color c) {label_.color=c;} /** Gets the font to use. Fonts are identified by indexes into a table. The default value uses a Helvetica typeface (Arial for Microsoft® Windows®). The function Fl::set_font() can define new typefaces. \return current font used by the label \see Fl_Font */ Fl_Font labelfont() const {return label_.font;} /** Sets the font to use. Fonts are identified by indexes into a table. The default value uses a Helvetica typeface (Arial for Microsoft® Windows®). The function Fl::set_font() can define new typefaces. \param[in] f the new font for the label \see Fl_Font */ void labelfont(Fl_Font f) {label_.font=f;} /** Gets the font size in pixels. The default size is 14 pixels. \return the current font size */ Fl_Fontsize labelsize() const {return label_.size;} /** Sets the font size in pixels. \param[in] pix the new font size \see Fl_Fontsize labelsize() */ void labelsize(Fl_Fontsize pix) {label_.size=pix;} /** Gets the image that is used as part of the widget label when in the active state. \return the current image */ Fl_Image* image() {return label_.image;} /** Gets the image that is used as part of the widget label when in the active state. \return the current image */ const Fl_Image* image() const {return label_.image;} /** Sets the image to use as part of the widget label when in the active state. The caller is responsible for making sure \p img is not deleted while it's used by the widget, and, if appropriate, for deleting it after the widget's deletion. Calling image() with a new image will delete the old image if it was bound, and set the new image without binding it. If old and new are the same, the image will not be deleted, but it will be unbound. Calling image() with NULL will delete the old image if it was bound and not set a new image. \param[in] img the new image for the label \see bind_image(Fl_Image* img) */ void image(Fl_Image* img); /** Sets the image to use as part of the widget label when in the active state. \param[in] img the new image for the label \see void image(Fl_Image* img) */ void image(Fl_Image& img); /** Sets the image to use as part of the widget label when in the active state. The image will be bound to the widget. When the widget is deleted, the image will be deleted as well. Calling bind_image() with a new image will delete the old image if it was bound, and then set the new image, and bind that. If old and new image are the same, nothing happens. Calling bind_image() with NULL will delete the old image if it was bound and not set a new image. \param[in] img the new image for the label \see void image(Fl_Image* img) */ void bind_image(Fl_Image* img); /** Bind the image to the widget, so the widget will delete the image when it is no longer needed. \param f 1: mark the image as bound, 0: mark the image as managed by the user \see image_bound(), bind_deimage() */ void bind_image(int f) { if (f) set_flag(IMAGE_BOUND); else clear_flag(IMAGE_BOUND); } /** Returns whether the image is managed by the widget. \retval 0 if the image is not bound to the widget \retval 1 if the image will be deleted when the widget is deleted \see deimage_bound(), bind_image() */ int image_bound() const {return ((flags_ & IMAGE_BOUND) ? 1 : 0);} /** Gets the image that is used as part of the widget label when in the inactive state. \return the current image for the deactivated widget */ Fl_Image* deimage() {return label_.deimage;} /** Gets the image that is used as part of the widget label when in the inactive state. \return the current image for the deactivated widget */ const Fl_Image* deimage() const {return label_.deimage;} /** Sets the image to use as part of the widget label when in the inactive state. \param[in] img the new image for the deactivated widget \note The caller is responsible for making sure \p img is not deleted while it's used by the widget, and, if appropriate, for deleting it after the widget's deletion. \see void bind_deimage(Fl_Image* img) */ void deimage(Fl_Image* img); /** Sets the image to use as part of the widget label when in the inactive state. \param[in] img the new image for the deactivated widget \see void deimage(Fl_Image* img) */ void deimage(Fl_Image& img); /** Sets the image to use as part of the widget label when in the inactive state. \param[in] img the new image for the deactivated widget \note The image will be bound to the widget. When the widget is deleted, the image will be deleted as well. \see void deimage(Fl_Image* img) */ void bind_deimage(Fl_Image* img); /** Returns whether the inactive image is managed by the widget. \retval 0 if the image is not bound to the widget \retval 1 if the image will be deleted when the widget is deleted \see image_bound(), bind_deimage() */ int deimage_bound() const {return ((flags_ & DEIMAGE_BOUND) ? 1 : 0);} /** Bind the inactive image to the widget, so the widget will delete the image when it is no longer needed. \param f 1: mark the image as bound, 0: mark the image as managed by the user \see deimage_bound(), bind_image() */ void bind_deimage(int f) { if (f) set_flag(DEIMAGE_BOUND); else clear_flag(DEIMAGE_BOUND); } /** Set the gap between the label and the image in pixels. This value is limited to 0..255. \param[in] gap spacing in pixels */ void label_image_spacing(int gap) { label_.spacing = (uchar)gap; } /** Return the gap size between the label and the image. \return spacing in pixels */ int label_image_spacing() { return label_.spacing; } /** Set the spacing between the label and the horizontal edge of the widget. \param[in] px gap in pixels */ void horizontal_label_margin(int px) { label_.h_margin_ = (signed char)px; } /** Get the spacing between the label and the horizontal edge of the widget. \return px gap in pixels */ int horizontal_label_margin() { return label_.h_margin_; } /** Set the spacing between the label and the vertical edge of the widget. \param[in] px gap in pixels */ void vertical_label_margin(int px) { label_.v_margin_ = (signed char)px; } /** Get the spacing between the label and the vertical edge of the widget. \return px gap in pixels */ int vertical_label_margin() { return label_.v_margin_; } /** Gets the current tooltip text. \return a pointer to the tooltip text or NULL \see tooltip(const char*), copy_tooltip(const char*) */ const char *tooltip() const {return tooltip_;} void tooltip(const char *text); // see Fl_Tooltip void copy_tooltip(const char *text); // see Fl_Tooltip /** Gets the current callback function for the widget. Each widget has a single callback. \return current callback */ Fl_Callback_p callback() const {return callback_;} /** Sets the current callback function and data for the widget. Each widget has a single callback. \param[in] cb new callback \param[in] p user data */ void callback(Fl_Callback* cb, void* p) { callback_ = cb; user_data(p); } /** Sets the current callback function and managed user data for the widget. Setting auto_free will transfer ownership of the callback user data to the widget. Deleting the widget will then also delete the user data. \param[in] cb new callback \param[in] p user data \param[in] auto_free if set, the widget will free user data when destroyed */ void callback(Fl_Callback* cb, Fl_Callback_User_Data* p, bool auto_free) { callback_ = cb; user_data(p, auto_free); } /** Sets the current callback function for the widget. Each widget has a single callback. \param[in] cb new callback */ void callback(Fl_Callback* cb) {callback_ = cb;} /** Sets the current callback function for the widget. Each widget has a single callback. \param[in] cb new callback */ void callback(Fl_Callback0* cb) { callback_ = (Fl_Callback*)(fl_intptr_t)(cb); } /** Sets the current callback function for the widget. Each widget has a single callback. \param[in] cb new callback \param[in] p user data */ void callback(Fl_Callback1* cb, long p = 0) { callback_ = (Fl_Callback*)(fl_intptr_t)(cb); user_data((void*)(fl_intptr_t)p); } /** Gets the user data for this widget. Gets the current user data (void *) argument that is passed to the callback function. \return user data as a pointer */ void* user_data() const {return user_data_;} /** \brief Sets the user data for this widget. */ void user_data(void* v); /** \brief Sets the user data for this widget. */ void user_data(Fl_Callback_User_Data* v, bool auto_free); /** Gets the current user data (long) argument that is passed to the callback function. \note On platforms with sizeof(long) \< sizeof(void*), particularly on Windows 64-bit platforms, this method can truncate stored addresses \p (void*) to the size of a \p long value. Use with care and only if you are sure that the stored user_data value fits in a \p long value because it was stored with argument(long) or another method using only \p long values. You may want to use user_data() instead. \see user_data() */ long argument() const {return (long)(fl_intptr_t)user_data_;} /** Sets the current user data (long) argument that is passed to the callback function. \see argument() */ void argument(long v) {user_data((void*)(fl_intptr_t)v);} /** Returns the conditions under which the callback is called. You can set the flags with when(uchar), the default value is FL_WHEN_RELEASE. \return set of flags \see when(uchar), Fl_When, do_callback(), Fl::callback_reason() */ Fl_When when() const {return (Fl_When)when_;} /** Sets the flags used to decide when a callback is called. This controls when callbacks are done. The following values are useful, the default value is FL_WHEN_RELEASE: \li 0: The callback is not done, but changed() is turned on. \li FL_WHEN_CHANGED: The callback is done each time the text is changed by the user. \li FL_WHEN_RELEASE: The callback will be done when this widget loses the focus, including when the window is unmapped. This is a useful value for text fields in a panel where doing the callback on every change is wasteful. However the callback will also happen if the mouse is moved out of the window, which means it should not do anything visible (like pop up an error message). You might do better setting this to zero, and scanning all the items for changed() when the OK button on a panel is pressed. \li FL_WHEN_ENTER_KEY: If the user types the Enter key, the entire text is selected, and the callback is done if the text has changed. Normally the Enter key will navigate to the next field (or insert a newline for a Fl_Multiline_Input) - this changes the behavior. \li FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED: The Enter key will do the callback even if the text has not changed. Useful for command fields. \li \ref FL_WHEN_CLOSED : If the user requests that the widget is closed, the callback is called with \ref FL_REASON_CLOSED. The \ref Fl_Tabs widget checks this flag on its children to determine whether to display a close button on the tab of that widget. Fl_Widget::when() is a set of bitflags used by subclasses of Fl_Widget to decide when to do the callback. If the value is zero then the callback is never done. Other values are described in the individual widgets. This field is in the base class so that you can scan a panel and do_callback() on all the ones that don't do their own callbacks in response to an "OK" button. \param[in] i set of flags \see Fl_When, do_callback(), Fl::callback_reason() */ void when(uchar i) {when_ = i;} /** Returns whether a widget is visible. \retval 0 if the widget is not drawn and hence invisible. \see show(), hide(), visible_r() */ unsigned int visible() const {return !(flags_&INVISIBLE);} /** Returns whether a widget and all its parents are visible. \retval 0 if the widget or any of its parents are invisible. \see show(), hide(), visible() */ int visible_r() const; /** Makes a widget visible. An invisible widget never gets redrawn and does not get keyboard or mouse events, but can receive a few other events like FL_SHOW. The visible() method returns true if the widget is set to be visible. The visible_r() method returns true if the widget and all of its parents are visible. A widget is only visible if visible() is true on it and all of its parents. Changing it will send FL_SHOW or FL_HIDE events to the widget. Do not change it if the parent is not visible, as this will send false FL_SHOW or FL_HIDE events to the widget. redraw() is called if necessary on this or the parent. \see hide(), visible(), visible_r() */ virtual void show(); /** Makes a widget invisible. \see show(), visible(), visible_r() */ virtual void hide(); /** Makes the widget visible. You must still redraw the parent widget to see a change in the window. Normally you want to use the show() method instead. */ void set_visible() {flags_ &= ~INVISIBLE;} /** Hides the widget. You must still redraw the parent to see a change in the window. Normally you want to use the hide() method instead. */ void clear_visible() {flags_ |= INVISIBLE;} /** Returns whether the widget is active. \retval 0 if the widget is inactive \see active_r(), activate(), deactivate() */ unsigned int active() const {return !(flags_&INACTIVE);} /** Returns whether the widget and all of its parents are active. \retval 0 if this or any of the parent widgets are inactive \see active(), activate(), deactivate() */ int active_r() const; /** Activates the widget. Changing this value will send FL_ACTIVATE to the widget if active_r() is true. \see active(), active_r(), deactivate() */ void activate(); /** Deactivates the widget. Inactive widgets will be drawn "grayed out", e.g. with less contrast than the active widget. Inactive widgets will not receive any keyboard or mouse button events. Other events (including FL_ENTER, FL_MOVE, FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is only active if active() is true on it and all of its parents. Changing this value will send FL_DEACTIVATE to the widget if active_r() is true. Currently you cannot deactivate Fl_Window widgets. \see activate(), active(), active_r() */ void deactivate(); /** Returns if a widget is used for output only. output() means the same as !active() except it does not change how the widget is drawn. The widget will not receive any events. This is useful for making scrollbars or buttons that work as displays rather than input devices. \retval 0 if the widget is used for input and output \see set_output(), clear_output() */ unsigned int output() const {return (flags_&OUTPUT);} /** Sets a widget to output only. \see output(), clear_output() */ void set_output() {flags_ |= OUTPUT;} /** Sets a widget to accept input. \see set_output(), output() */ void clear_output() {flags_ &= ~OUTPUT;} /** Returns if the widget is able to take events. This is the same as (active() && !output() && visible()) but is faster. \retval 0 if the widget takes no events */ unsigned int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));} /** Checks if the widget value changed since the last callback. "Changed" is a flag that is turned on when the user changes the value stored in the widget. This is only used by subclasses of Fl_Widget that store values, but is in the base class so it is easier to scan all the widgets in a panel and do_callback() on the changed ones in response to an "OK" button. Most widgets turn this flag off when they do the callback, and when the program sets the stored value. \note do_callback() turns this flag off after the callback. \retval 0 if the value did not change \see set_changed(), clear_changed() \see do_callback(Fl_Widget *widget, void *data) */ unsigned int changed() const {return flags_ & CHANGED;} /** Marks the value of the widget as changed. \see changed(), clear_changed() */ void set_changed() {flags_ |= CHANGED;} /** Marks the value of the widget as unchanged. \see changed(), set_changed() */ void clear_changed() {flags_ &= ~CHANGED;} /** Marks the widget as inactive without sending events or changing focus. This is mainly for specialized use, for normal cases you want deactivate(). \see deactivate() */ void clear_active() {flags_ |= INACTIVE;} /** Marks the widget as active without sending events or changing focus. This is mainly for specialized use, for normal cases you want activate(). \see activate() */ void set_active() {flags_ &= ~INACTIVE;} /** Gives the widget the keyboard focus. Tries to make this widget be the Fl::focus() widget, by first sending it an FL_FOCUS event, and if it returns non-zero, setting Fl::focus() to this widget. You should use this method to assign the focus to a widget. \return true if the widget accepted the focus. */ int take_focus(); /** Enables keyboard focus navigation with this widget. Note, however, that this will not necessarily mean that the widget will accept focus, but for widgets that can accept focus, this method enables it if it has been disabled. \see visible_focus(), clear_visible_focus(), visible_focus(int) */ void set_visible_focus() { flags_ |= VISIBLE_FOCUS; } /** Disables keyboard focus navigation with this widget. Normally, all widgets participate in keyboard focus navigation. \see set_visible_focus(), visible_focus(), visible_focus(int) */ void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; } /** Modifies keyboard focus navigation. \param[in] v set or clear visible focus \see set_visible_focus(), clear_visible_focus(), visible_focus() */ void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); } /** Checks whether this widget has a visible focus. \retval 0 if this widget has no visible focus. \see visible_focus(int), set_visible_focus(), clear_visible_focus() */ unsigned int visible_focus() const { return flags_ & VISIBLE_FOCUS; } /** The default callback for all widgets that don't set a callback. This callback function puts a pointer to the widget on the queue returned by Fl::readqueue(). This is the default for all widgets if you don't set a callback. You can avoid the overhead of this default handling if you set the callback to \p NULL explicitly. Relying on the default callback and reading the callback queue with Fl::readqueue() is not recommended. If you need a callback, you should set one with Fl_Widget::callback(Fl_Callback *cb, void *data) or one of its variants. \param[in] widget the Fl_Widget given to the callback \param[in] data user data associated with that callback \see callback(), Fl::readqueue() \see do_callback(Fl_Widget *widget, void *data) */ static void default_callback(Fl_Widget *widget, void *data); /** Calls the widget callback function with default arguments. This is the same as calling \code do_callback(this, user_data(), reason); \endcode \param[in] reason give a reason to why this callback was called, defaults to \ref FL_REASON_UNKNOWN \see callback() \see do_callback(Fl_Widget *widget, void *data, Fl_Callback_Reason reason), Fl_Callback_Reason */ void do_callback(Fl_Callback_Reason reason=FL_REASON_UNKNOWN) {do_callback(this, user_data_, reason);} /** Calls the widget callback function with arbitrary arguments. \param[in] widget call the callback with \p widget as the first argument \param[in] arg call the callback with \p arg as the user data (second) argument \param[in] reason give a reason to why this callback was called, defaults to \ref FL_REASON_UNKNOWN \see callback() \see do_callback(Fl_Widget *widget, void *data), Fl_Callback_Reason */ void do_callback(Fl_Widget *widget, long arg, Fl_Callback_Reason reason=FL_REASON_UNKNOWN) { do_callback(widget, (void*)(fl_intptr_t)arg, reason); } void do_callback(Fl_Widget *widget, void *arg = 0, Fl_Callback_Reason reason=FL_REASON_UNKNOWN); /* Internal use only. */ int test_shortcut(); /* Internal use only. */ static unsigned int label_shortcut(const char *t); /* Internal use only. */ static int test_shortcut(const char*, const bool require_alt = false); /* Internal use only. */ void _set_fullscreen() {flags_ |= FULLSCREEN;} void _clear_fullscreen() {flags_ &= ~FULLSCREEN;} /** Checks if w is a child of this widget. \param[in] w potential child widget \return Returns 1 if \p w is a child of this widget, or is equal to this widget. Returns 0 if \p w is NULL. */ int contains(const Fl_Widget *w) const ; /** Checks if this widget is a child of \p wgt. Returns 1 if this widget is a child of \p wgt, or is equal to \p wgt. Returns 0 if \p wgt is NULL. \param[in] wgt the possible parent widget. \see contains() */ int inside(const Fl_Widget *wgt) const {return wgt ? wgt->contains(this) : 0;} /** Schedules the drawing of the widget. Marks the widget as needing its draw() routine called. */ void redraw(); /** Schedules the drawing of the label. Marks the widget or the parent as needing a redraw for the label area of a widget. */ void redraw_label(); /** Returns non-zero if draw() needs to be called. The damage value is actually a bit field that the widget subclass can use to figure out what parts to draw. \return a bitmap of flags describing the kind of damage to the widget \see damage(uchar), clear_damage(uchar) */ uchar damage() const {return damage_;} /** Clears or sets the damage flags. Damage flags are cleared when parts of the widget drawing is repaired. The optional argument \p c specifies the bits that are set after the call (default: 0) and \b not the bits that are cleared! \note Therefore it is possible to set damage bits with this method, but this should be avoided. Use damage(uchar) instead. \param[in] c new bitmask of damage flags (default: 0) \see damage(uchar), damage() */ void clear_damage(uchar c = 0) {damage_ = c;} /** Sets the damage bits for the widget. Setting damage bits will schedule the widget for the next redraw. \param[in] c bitmask of flags to set \see damage(), clear_damage(uchar) */ void damage(uchar c); /** Sets the damage bits for an area inside the widget. Setting damage bits will schedule the widget for the next redraw. \param[in] c bitmask of flags to set \param[in] x, y, w, h size of damaged area \see damage(), clear_damage(uchar) */ void damage(uchar c, int x, int y, int w, int h); void draw_label(int, int, int, int, Fl_Align) const; /** Sets width ww and height hh accordingly with the label size. Labels with images will return w() and h() of the image. This calls fl_measure() internally. For more information about the arguments \p ww and \p hh and word wrapping \see fl_measure(const char*, int&, int&, int) */ void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);} Fl_Window* window() const ; Fl_Window* top_window() const; Fl_Window* top_window_offset(int& xoff, int& yoff) const; /** Returns an Fl_Group pointer if this widget is an Fl_Group. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Group. If it returns non-NULL, then the widget in question is derived from Fl_Group, and you can use the returned pointer to access its children or other Fl_Group-specific methods. Example: \code void my_callback (Fl_Widget *w, void *) { Fl_Group *g = w->as_group(); if (g) printf ("This group has %d children\n", g->children()); else printf ("This widget is not a group!\n"); } \endcode \retval NULL if this widget is not derived from Fl_Group. \note This method is provided to avoid dynamic_cast. \see Fl_Widget::as_window(), Fl_Widget::as_gl_window() */ virtual Fl_Group* as_group() { return NULL; } virtual Fl_Group const* as_group() const { return NULL; } /** Returns an Fl_Window pointer if this widget is an Fl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Window, and you can use the returned pointer to access its children or other Fl_Window-specific methods. \retval NULL if this widget is not derived from Fl_Window. \note This method is provided to avoid dynamic_cast. \see Fl_Widget::as_group(), Fl_Widget::as_gl_window() */ virtual Fl_Window* as_window() { return 0; } virtual Fl_Window const* as_window() const { return NULL; } /** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window. Use this method if you have a widget (pointer) and need to know whether this widget is derived from Fl_Gl_Window. If it returns non-NULL, then the widget in question is derived from Fl_Gl_Window. \retval NULL if this widget is not derived from Fl_Gl_Window. \note This method is provided to avoid dynamic_cast. \see Fl_Widget::as_group(), Fl_Widget::as_window() */ virtual class Fl_Gl_Window* as_gl_window() { return NULL; } virtual class Fl_Gl_Window const* as_gl_window() const { return NULL; } /** Returns non zero if MAC_USE_ACCENTS_MENU flag is set, 0 otherwise. */ int use_accents_menu() { return flags() & MAC_USE_ACCENTS_MENU; } /** For back compatibility only. \deprecated Use selection_color() instead. */ Fl_Color color2() const {return (Fl_Color)color2_;} /** For back compatibility only. \deprecated Use selection_color(unsigned) instead. */ void color2(unsigned a) {color2_ = a;} /** Sets whether the widget's label uses '&' to indicate shortcuts. By default, all objects of classes Fl_Menu_ (and derivatives), Fl_Button (and derivatives), Fl_Text_Display, Fl_Value_Input, and Fl_Input_ (and derivatives) use character '&' in their label, unless '&' is repeated, to indicate shortcuts: '&' does not appear in the drawn label, the next character after '&' in the label is drawn underlined, and typing this character triggers the corresponding menu window, button, or other widget. If the label contains 2 consecutive '&', only one is drawn and the next character is not underlined and not used as a shortcut. If \p value is set to 0, all these labels don't process character '&' as indicating a shortcut: '&' is drawn in the label, the next character is not underlined and does not define a shortcut. */ void shortcut_label(int value) { if (value) set_flag(SHORTCUT_LABEL); else clear_flag(SHORTCUT_LABEL); } /** Returns whether the widget's label uses '&' to indicate shortcuts. \see void shortcut_label(int value) */ int shortcut_label() const { return flags_ & SHORTCUT_LABEL; } }; /** Reserved type numbers (necessary for my cheapo RTTI) start here. Grep the header files for "RESERVED_TYPE" to find the next available number. */ #define FL_RESERVED_TYPE 100 #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Widget_Surface.H ================================================ // // Drivers code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2016 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef Fl_Widget_Surface_h #define Fl_Widget_Surface_h #include #include /** A surface on which any FLTK widget can be drawn. */ class FL_EXPORT Fl_Widget_Surface : public Fl_Surface_Device { private: void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them protected: /** \brief horizontal offset to the origin of graphics coordinates */ int x_offset; /** \brief vertical offset to the origin of graphics coordinates */ int y_offset; Fl_Widget_Surface(Fl_Graphics_Driver *d); public: virtual void translate(int x, int y); virtual void untranslate(); void draw(Fl_Widget* widget, int delta_x = 0, int delta_y = 0); void draw_decorated_window(Fl_Window *win, int x_offset = 0, int y_offset = 0); void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0); virtual int printable_rect(int *w, int *h); virtual void origin(int x, int y); virtual void origin(int *x, int *y); }; #endif /* Fl_Widget_Surface_h */ ================================================ FILE: Game Trainers/common/include/FL/Fl_Window.H ================================================ // // Window header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file Fl_Window widget . */ #ifndef Fl_Window_H #define Fl_Window_H #include #include #include #define FL_WINDOW 0xF0 ///< window type id: all subclasses have type() >= this #define FL_DOUBLE_WINDOW 0xF1 ///< double window type id class Fl_X; class Fl_Window_Driver; class Fl_RGB_Image; class Fl_Double_Window; /** This widget produces an actual window. This can either be a main window, with a border and title and all the window management controls, or a "subwindow" inside a window. This is controlled by whether or not the window has a parent(). Once you create a window, you usually add children Fl_Widget's to it by using window->add(child) for each new widget. See Fl_Group for more information on how to add and remove children. There are several subclasses of Fl_Window that provide double-buffering, overlay, menu, and OpenGL support. The window's callback is done if the user tries to close a window using the window manager and Fl::modal() is zero or equal to the window. Fl_Window has a default callback that calls Fl_Window::hide(). Callback reasons can be \p FL_REASON_CANCELLED if the Escape key was pressed, or \p FL_REASON_CLOSED when the close button is clicked. \p FL_WHEN_... flags are ignored. */ class FL_EXPORT Fl_Window : public Fl_Group { friend class Fl_X; friend class Fl_Window_Driver; private: static char *default_xclass_; static char show_next_window_iconic_; // 1 means create next window in iconic form int no_fullscreen_x; int no_fullscreen_y; int no_fullscreen_w; int no_fullscreen_h; int fullscreen_screen_top; int fullscreen_screen_bottom; int fullscreen_screen_left; int fullscreen_screen_right; // TODO: it would make sense to merge the use of Fl_X and Fl_Window_Driver, maybe simply by // TODO: deriving Fl_Window_Driver from Fl_X. However, there are a lot of historic kludges // TODO: for some platforms around Fl_X. Fl_X *flx_; // points at the system-specific stuff, but exists only after the window is mapped Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creation time const char* iconlabel_; char* xclass_; // private size_range stuff: int minw_, minh_, maxw_, maxh_; int dw_, dh_, aspect_; uchar size_range_set_; // true (1) if size_range() has been set or calculated // cursor stuff Fl_Cursor cursor_default; void _Fl_Window(); // constructor innards // unimplemented copy ctor and assignment operator Fl_Window(const Fl_Window&); Fl_Window& operator=(const Fl_Window&); void is_maximized_(bool b); protected: /** Stores the last window that was made current. See current() const */ static Fl_Window *current_; void draw() FL_OVERRIDE; public: /** Forces the window to be drawn, this window is also made current and calls draw(). */ virtual void flush(); protected: /** Sets an internal flag that tells FLTK and the window manager to honor position requests. This is used internally and should not be needed by user code. \param[in] force 1 to set the FORCE_POSITION flag, 0 to clear it */ void force_position(int force) { if (force) set_flag(FORCE_POSITION); else clear_flag(FORCE_POSITION); } /** Returns the internal state of the window's FORCE_POSITION flag. \retval 1 if flag is set \retval 0 otherwise \see force_position(int) */ int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } void free_icons(); void default_size_range(); // calculate size_range() if not set explicitly int is_resizable(); // calculate size_range() and return whether this is resizable public: /** Creates a window from the given width \p w, height \p h, and \p title. If Fl_Group::current() is not NULL, the window is created as a subwindow of the parent window. The (w, h) form of the constructor creates a top-level window and asks the window manager to position the window. The (x, y, w, h) form of the constructor either creates a subwindow or a top-level window at the specified location (x, y), subject to window manager configuration. If you do not specify the position of the window, the window manager will pick a place to show the window or allow the user to pick a location. Use position(x, y) or hotspot() before calling show() to request a position on the screen. See Fl_Window::resize() for some more details on positioning windows. Top-level windows initially have visible() set to 0 and parent() set to NULL. Subwindows initially have visible() set to 1 and parent() set to the parent window pointer. Fl_Widget::box() defaults to FL_FLAT_BOX. If you plan to completely fill the window with children widgets you should change this to FL_NO_BOX. If you turn the window border off you may want to change this to FL_UP_BOX. \see Fl_Window(int x, int y, int w, int h, const char *title) */ Fl_Window(int w, int h, const char *title = 0); /** Creates a window from the given position (x, y), size (w, h) and title. On a multi-screen system, the values computed by Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) can be used to discover the coordinates of the area of screen \#n. When these screens have various scale factor values, an \p (x, y) pair may not be enough to specify the targeted screen for the window, because the same \p (x,y) pair can belong to several screens. In that situation, a call to Fl_Window::screen_num(int) is to be used to identify unambiguously the targeted screen. \see Fl_Window(int w, int h, const char *title) \see Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) \note Under Wayland, it's generally not possible for the client app to control the position of a window in the system. It's possible to specify on what screen should the compositor place a fullscreen window. It's also possible to make an Fl_Window the child of another window or group and control with \p x and \p y its screen position relatively to the enclosing window. Apply member function Fl_Window::allow_expand_outside_parent() to the child window to allow it to expand partially or totally outside its parent. */ Fl_Window(int x, int y, int w, int h, const char *title = 0); /** The destructor also deletes all the children. This allows a whole tree to be deleted at once, without having to keep a pointer to all the children in the user code. A kludge has been done so the Fl_Window and all of its children can be automatic (local) variables, but you must declare the Fl_Window first so that it is destroyed last. */ virtual ~Fl_Window(); int handle(int) FL_OVERRIDE; /** Changes the size and position of the window. If shown() is true, these changes are communicated to the window server (which may refuse that size and cause a further resize). If shown() is false, the size and position are used when show() is called. See Fl_Group for the effect of resizing on the child widgets. You can also call the Fl_Widget methods size(x,y) and position(w,h), which are inline wrappers for this virtual function. A top-level window can not force, but merely suggest a position and size to the operating system. The window manager may not be willing or able to display a window at the desired position or with the given dimensions. It is up to the application developer to verify window parameters after the resize request. */ void resize(int X,int Y,int W,int H) FL_OVERRIDE; /** Sets whether or not the window manager border is around the window. The default value is true. The macOS platform ignores requests to change the border state of a fullscreen or maximized window. With some X window managers, this does not work after show() has been called. */ void border(int b); /** Fast inline function to turn the window manager border off. It only works before show() is called. */ void clear_border() {set_flag(NOBORDER);} /** Returns whether the window possesses a border */ unsigned int border() const {return !(flags() & NOBORDER);} /** Activates the flags NOBORDER|OVERRIDE */ void set_override() {set_flag(NOBORDER|OVERRIDE);} /** Returns non zero if OVERRIDE flag is set, 0 otherwise. */ unsigned int override() const { return flags()&OVERRIDE; } /** A "modal" window, when shown(), will prevent any events from being delivered to other windows in the same program, and will also remain on top of the other windows (if the X window manager supports the "transient for" property). Several modal windows may be shown at once, in which case only the last one shown gets events. You can see which window (if any) is modal by calling Fl::modal(). */ void set_modal() {set_flag(MODAL);} /** Returns true if this window is modal. */ unsigned int modal() const {return flags() & MODAL;} /** A "non-modal" window (terminology borrowed from Microsoft Windows) acts like a modal() one in that it remains on top, but it has no effect on event delivery. There are three states for a window: modal, non-modal, and normal. */ void set_non_modal() {set_flag(NON_MODAL);} /** Returns true if this window is modal or non-modal. */ unsigned int non_modal() const {return flags() & (NON_MODAL|MODAL);} /** Clears the "modal" flags and converts a "modal" or "non-modal" window back into a "normal" window. Note that there are three states for a window: modal, non-modal, and normal. You can not change the "modality" of a window whilst it is shown, so it is necessary to first hide() the window, change its "modality" as required, then re-show the window for the new state to take effect. This method can also be used to change a "modal" window into a "non-modal" one. On several supported platforms, the "modal" state over-rides the "non-modal" state, so the "modal" state must be cleared before the window can be set into the "non-modal" state. In general, the following sequence should work: \code win->hide(); win->clear_modal_states(); // Set win to new state as desired, or leave "normal", e.g... win->set_non_modal(); win->show(); \endcode \note Under some window managers, the sequence of hiding the window and changing its modality will often cause it to be re-displayed at a different position when it is subsequently shown. This is an irritating feature but appears to be unavoidable at present. As a result we would advise to use this method only when absolutely necessary. \see void set_modal(), void set_non_modal() */ void clear_modal_states() {clear_flag(NON_MODAL | MODAL);} /** Marks the window as a menu window. This is intended for internal use, but it can also be used if you write your own menu handling. However, this is not recommended. This flag is used for correct "parenting" of windows in communication with the windowing system. Modern X window managers can use different flags to distinguish menu and tooltip windows from normal windows. This must be called before the window is shown and cannot be changed later. */ void set_menu_window() {set_flag(MENU_WINDOW);} /** Returns true if this window is a menu window. */ unsigned int menu_window() const {return flags() & MENU_WINDOW;} /** Marks the window as a tooltip window. This is intended for internal use, but it can also be used if you write your own tooltip handling. However, this is not recommended. This flag is used for correct "parenting" of windows in communication with the windowing system. Modern X window managers can use different flags to distinguish menu and tooltip windows from normal windows. This must be called before the window is shown and cannot be changed later. \note Since Fl_Tooltip_Window is derived from Fl_Menu_Window, this also \b clears the menu_window() state. */ void set_tooltip_window() { set_flag(TOOLTIP_WINDOW); clear_flag(MENU_WINDOW); } /** Returns true if this window is a tooltip window. */ unsigned int tooltip_window() const {return flags() & TOOLTIP_WINDOW;} /** Positions the window so that the mouse is pointing at the given position, or at the center of the given widget, which may be the window itself. If the optional offscreen parameter is non-zero, then the window is allowed to extend off the screen (this does not work with some X window managers). \see position() */ void hotspot(int x, int y, int offscreen = 0); /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */ void hotspot(const Fl_Widget*, int offscreen = 0); /** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */ void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);} /** Undoes the effect of a previous resize() or show() so that the next time show() is called the window manager is free to position the window. This is for Forms compatibility only. \deprecated please use force_position(0) instead */ void free_position() {clear_flag(FORCE_POSITION);} void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0); uchar get_size_range(int *minw, int *minh, int *maxw=NULL, int *maxh=NULL, int *dw=NULL, int *dh=NULL, int *aspect=NULL); /** See void Fl_Window::label(const char*) */ const char* label() const {return Fl_Widget::label();} /** See void Fl_Window::iconlabel(const char*) */ const char* iconlabel() const {return iconlabel_;} /** Sets the window title bar label. */ void label(const char*); /** Sets the icon label. */ void iconlabel(const char*); /** Sets the icon label. */ void label(const char* label, const char* iconlabel); // platform dependent void copy_label(const char* a); static void default_xclass(const char*); static const char *default_xclass(); const char* xclass() const; void xclass(const char* c); static void default_icon(const Fl_RGB_Image*); static void default_icons(const Fl_RGB_Image*[], int); void icon(const Fl_RGB_Image*); void icons(const Fl_RGB_Image*[], int); #if defined(_WIN32) || defined(FL_DOXYGEN) typedef struct HICON__* HICON; // These 2 member functions break the driver model but are kept for back compatibility. // They are implemented in Fl_win32.cxx /** Sets the default window icons (Windows platform only). Convenience function to set the default icons using Windows' native HICON icon handles. The given icons are copied. You can free the icons immediately after this call. \param[in] big_icon default large icon for all windows subsequently created \param[in] small_icon default small icon for all windows subsequently created \see Fl_Window::default_icon(const Fl_RGB_Image *) \see Fl_Window::default_icons(const Fl_RGB_Image *[], int) \see Fl_Window::icon(const Fl_RGB_Image *) \see Fl_Window::icons(const Fl_RGB_Image *[], int) \see Fl_Window::icons(HICON, HICON) */ static void default_icons(HICON big_icon, HICON small_icon); /** Sets the window icons using HICON handles (Windows platform only). The given icons are copied. You can free the icons immediately after this call. \param[in] big_icon large window icon \param[in] small_icon small window icon */ void icons(HICON big_icon, HICON small_icon); #endif // defined(_WIN32) || defined(FL_DOXYGEN) /* for legacy compatibility */ const void* icon() const; void icon(const void * ic); /** Returns non-zero if show() has been called (but not hide() ). You can tell if a window is iconified with (w->shown() && !w->visible()). */ int shown() {return flx_ != 0;} /** Puts the window on the screen. This has the side effect of opening the display, if not done before. If the window is already shown then it is restored and raised to the top. This is really convenient because your program can call show() at any time, even if the window is already up. It also means that show() serves the purpose of raise() in other toolkits. Fl_Window::show(int argc, char **argv) is used for top-level windows and allows standard arguments to be parsed from the command-line. \note For some obscure reasons Fl_Window::show() resets the current group by calling Fl_Group::current(0). The comments in the code say "get rid of very common user bug: forgot end()". Although this is true it may have unwanted side effects if you show() an unrelated window (maybe for an error message or warning) while building a window or any other group widget. \todo Check if we can remove resetting the current group in a later FLTK version (after 1.3.x). This may break "already broken" programs though if they rely on this "feature". \see Fl_Window::show(int argc, char **argv) */ void show() FL_OVERRIDE; /** Removes the window from the screen. If the window is already hidden or has not been shown then this does nothing and is harmless. */ void hide() FL_OVERRIDE; /** Puts the window on the screen with show() and parses command-line arguments. This call should be used for top-level windows, at least for the first (main) window. It allows standard arguments to be parsed, as done by Fl::args(int, char **), from the command-line. You can use \p argc and \p argv from main(int argc, char **argv) for this call. This call also sets up some system-specific internal variables, that is, it sets FL_SELECTION_COLOR and calls Fl::background(), Fl::background2(), Fl::foreground() with default or X resources-given values, and calls Fl::scheme(const char *) for the current scheme. On X11, it also calls Fl::dnd_text_ops(int), Fl_Tooltip::enable(int), Fl::visible_focus(int) with X resources-given values. \param argc command-line argument count, usually from main() \param argv command-line argument vector, usually from main() \see virtual void Fl_Window::show() \see Fl::args(int, char **) */ void show(int argc, char **argv); // Enables synchronous show(), docs in Fl_Window.cxx void wait_for_expose(); /** Makes the window completely fill one or more screens, without any window manager border visible. You must use fullscreen_off() to undo this. \note On some platforms, this can result in the keyboard being grabbed. The window may also be recreated, meaning hide() and show() will be called. \see void Fl_Window::fullscreen_screens() */ void fullscreen(); /** Turns off any side effects of fullscreen() */ void fullscreen_off(); /** Turns off any side effects of fullscreen() and does resize(x,y,w,h). */ void fullscreen_off(int X,int Y,int W,int H); /** Returns non zero if FULLSCREEN flag is set, 0 otherwise. */ unsigned int fullscreen_active() const { return flags() & FULLSCREEN; } /** Sets which screens should be used when this window is in fullscreen mode. The window will be resized to the top of the screen with index \p top, the bottom of the screen with index \p bottom, etc. If this method is never called, or if any argument is < 0, then the window will be resized to fill the screen it is currently on. \see void Fl_Window::fullscreen() */ void fullscreen_screens(int top, int bottom, int left, int right); void maximize(); void un_maximize(); /** Returns whether the window is currently maximized */ unsigned int maximize_active() const { return flags() & MAXIMIZED; } public: /** Iconifies the window. If you call this when shown() is false it will show() it as an icon. If the window is already iconified this does nothing. Call show() to restore the window. When a window is iconified/restored (either by these calls or by the user) the handle() method is called with FL_HIDE and FL_SHOW events and visible() is turned on and off. There is no way to control what is drawn in the icon except with the string passed to Fl_Window::xclass(). You should not rely on window managers displaying the icons. */ void iconize(); int x_root() const ; int y_root() const ; static Fl_Window *current(); /** Sets things up so that the drawing functions in will go into this window. This is useful for incremental update of windows, such as in an idle callback, which will make your program behave much better if it draws a slow graphic. Danger: incremental update is very hard to debug and maintain! This method only works for the Fl_Window and Fl_Gl_Window derived classes. */ void make_current(); void cursor(Fl_Cursor); void cursor(const Fl_RGB_Image*, int, int); void default_cursor(Fl_Cursor); /* for legacy compatibility */ void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); static void default_callback(Fl_Window*, void* v); /** Returns the window width including any frame added by the window manager. Same as w() if applied to a subwindow, or if window is not yet mapped. \see decorated_h(). */ int decorated_w() const; /** Returns the window height including any window title bar and any frame added by the window manager. Same as h() if applied to a subwindow, or if window is not yet mapped. \note Under X11, FLTK is able to compute the size of window titlebars and borders only if these decoration elements are strictly X11-based. When that's not the case, decorated_h() returns the same value as h() and decorated_w() as w(), and FLTK cannot access window decorations. \note Under X11 again, the values returned by decorated_h() and decorated_w() may not be reliable during a resize operation. The size of decoration elements of a window is best computed when the window is first mapped. */ int decorated_h() const; // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. Fl_Window* as_window() FL_OVERRIDE { return this; } Fl_Window const* as_window() const FL_OVERRIDE { return this; } /** Return non-null if this is an Fl_Overlay_Window object. */ virtual class Fl_Overlay_Window *as_overlay_window() {return 0L; } /** Return non-null if this is an Fl_Double_Window object. */ virtual class Fl_Double_Window *as_double_window() {return 0L;} void shape(const Fl_Image* img); void shape(const Fl_Image& b); const Fl_Image *shape(); void draw_backdrop(); int screen_num(); void screen_num(int screen_num); static bool is_a_rescale(); fl_uintptr_t os_id(); /** Sets a static flag whether the next window should be opened iconified. \note This is an internal function, you should not use this in user code. Please use Fl_Window::iconize() instead. */ static void show_next_window_iconic(char stat) { show_next_window_iconic_ = stat ? 1 : 0; } /** Returns the static flag whether the next window should be opened iconified. \note This is an internal function, you should not use this in user code. Please use Fl_Window::iconize() to iconify a window. */ static char show_next_window_iconic() { return show_next_window_iconic_; } void allow_expand_outside_parent(); }; #endif ================================================ FILE: Game Trainers/common/include/FL/Fl_Wizard.H ================================================ // // Fl_Wizard widget definitions. // // Copyright 1999-2010 by Easy Software Products. // Copyright 2011-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_Wizard widget . */ // // Include necessary header files... // #ifndef _Fl_Wizard_H_ #define _Fl_Wizard_H_ #include /** This widget is based off the Fl_Tabs widget, but instead of displaying tabs it only changes "tabs" under program control. Its primary purpose is to support "wizards" that step a user through configuration or troubleshooting tasks. As with Fl_Tabs, wizard panes are composed of child (usually Fl_Group) widgets. Navigation buttons must be added separately. */ class FL_EXPORT Fl_Wizard : public Fl_Group { Fl_Widget *value_; protected: void draw() FL_OVERRIDE; public: Fl_Wizard(int, int, int, int, const char * = 0); void next(); void prev(); Fl_Widget *value(); void value(Fl_Widget *); }; #endif // !_Fl_Wizard_H_ ================================================ FILE: Game Trainers/common/include/FL/Fl_XBM_Image.H ================================================ // // XBM image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_XBM_Image class . */ #ifndef Fl_XBM_Image_H #define Fl_XBM_Image_H # include "Fl_Bitmap.H" /** The Fl_XBM_Image class supports loading, caching, and drawing of X Bitmap (XBM) bitmap files. */ class FL_EXPORT Fl_XBM_Image : public Fl_Bitmap { public: Fl_XBM_Image(const char* filename); }; #endif // !Fl_XBM_Image_H ================================================ FILE: Game Trainers/common/include/FL/Fl_XPM_Image.H ================================================ // // XPM image header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /* \file Fl_XPM_Image class . */ #ifndef Fl_XPM_Image_H #define Fl_XPM_Image_H # include "Fl_Pixmap.H" /** The Fl_XPM_Image class supports loading, caching, and drawing of X Pixmap (XPM) images, including transparency. */ class FL_EXPORT Fl_XPM_Image : public Fl_Pixmap { public: Fl_XPM_Image(const char* filename); }; #endif // !Fl_XPM_Image ================================================ FILE: Game Trainers/common/include/FL/Makefile.in ================================================ # # Header Makefile for the Fast Light Tool Kit (FLTK). # # Copyright 1998-2021 by Bill Spitzak and others. # # This library is free software. Distribution and use rights are outlined in # the file "COPYING" which should have been included with this file. If this # file is missing or damaged, see the license at: # # https://www.fltk.org/COPYING.php # # Please see the following page on how to report bugs and issues: # # https://www.fltk.org/bugs.php # include ../makeinclude all: clean: depend: install: echo "Installing include files in $(DESTDIR)$(includedir)..." $(RMDIR) "$(DESTDIR)$(includedir)/FL" $(INSTALL_DIR) "$(DESTDIR)$(includedir)/FL" for file in *.[hH]; do \ $(INSTALL_DATA) $$file "$(DESTDIR)$(includedir)/FL"; \ done @HLINKS@ cd "$(DESTDIR)$(includedir)/FL";\ @HLINKS@ for file in *.H; do\ @HLINKS@ $(RM) "`basename $$file H`h";\ @HLINKS@ $(LN) $$file "`basename $$file H`h";\ @HLINKS@ done @HLINKS@ $(RM) "$(DESTDIR)$(includedir)/FL/fl_file_chooser.H" @HLINKS@ $(LN) Fl_File_Chooser.H "$(DESTDIR)$(includedir)/FL/fl_file_chooser.H" @HLINKS@ $(RM) "$(DESTDIR)$(includedir)/FL/fl_file_chooser.h" @HLINKS@ $(LN) Fl_File_Chooser.H "$(DESTDIR)$(includedir)/FL/fl_file_chooser.h" @HLINKS@ $(RM) "$(DESTDIR)$(includedir)/Fl" @HLINKS@ $(LN) FL "$(DESTDIR)$(includedir)/Fl" uninstall: echo "Uninstalling include files..." $(RMDIR) "$(DESTDIR)$(includedir)/FL" @HLINKS@ $(RM) "$(DESTDIR)$(includedir)/Fl" ================================================ FILE: Game Trainers/common/include/FL/README.Xcode ================================================ All FLTK header files are in the FL subdirectory of the fltk.framework. Image header files are located in "fltk.framework/Headers/FL/images/". ================================================ FILE: Game Trainers/common/include/FL/filename.H ================================================ /* * Filename header file for the Fast Light Tool Kit (FLTK). * * Copyright 1998-2023 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /* * Note to devs: * Under Windows, we include filename.H from numericsort.c; this should probably change. * This implies that we need C-style comments and '#ifdef __cplusplus ... #endif' */ /** \file File names and URI utility functions. */ #ifndef FL_FILENAME_H # define FL_FILENAME_H #include "Fl_Export.H" #include #ifdef __cplusplus // The following include is not (yet) used in FLTK 1.4 // In FLTK 1.5 or 4.0 using std::string would be default. // #include #endif /* __cplusplus */ /** \addtogroup filenames File names and URI utility functions File names and URI functions defined in @{ */ # define FL_PATH_MAX 2048 /**< all path buffers should use this length */ /** Gets the file name from a path. Similar to basename(3), exceptions shown below. \code #include [..] const char *out; out = fl_filename_name("/usr/lib"); // out="lib" out = fl_filename_name("/usr/"); // out="" (basename(3) returns "usr" instead) out = fl_filename_name("/usr"); // out="usr" out = fl_filename_name("/"); // out="" (basename(3) returns "/" instead) out = fl_filename_name("."); // out="." out = fl_filename_name(".."); // out=".." \endcode \return a pointer to the char after the last slash, or to \p filename if there is none. */ FL_EXPORT const char *fl_filename_name(const char * filename); FL_EXPORT const char *fl_filename_ext(const char *buf); FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext); FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from); FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from); FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from); FL_EXPORT int fl_filename_match(const char *name, const char *pattern); FL_EXPORT int fl_filename_isdir(const char *name); # if defined(__cplusplus) FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from, const char *cwd); FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd); // FIXME: We can't do this in 1.4.x - enable this block in 1.5 or higher. // See fluid/fluid_filename.{h|cxx} for an implementation using Fl_String. // FL_EXPORT std::string fl_filename_name(const std::string &filename); // FL_EXPORT std::string fl_filename_path(const std::string &filename); // FL_EXPORT std::string fl_filename_ext(const std::string &filename); // FL_EXPORT std::string fl_filename_setext(const std::string &filename, const std::string &new_extension); // FL_EXPORT std::string fl_filename_expand(const std::string &from); // FL_EXPORT std::string fl_filename_absolute(const std::string &from); // FL_EXPORT std::string fl_filename_absolute(const std::string &from, const std::string &base); // FL_EXPORT std::string fl_filename_relative(const std::string &from); // FL_EXPORT std::string fl_filename_relative(const std::string &from, const std::string &base); // FL_EXPORT std::string fl_getcwd(); # endif /* defined(__cplusplus) */ # if defined(__cplusplus) && !defined(FL_DOXYGEN) /* * Under Windows, we include filename.H from numericsort.c; this should probably change... */ inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); } inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); } inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); } inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); } # endif /* __cplusplus */ # if defined (__cplusplus) extern "C" { # endif /* __cplusplus */ # if !defined(FL_DOXYGEN) FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **); FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **); FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **); FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **); # endif typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /**< File sorting function. \see fl_filename_list() */ # if defined(__cplusplus) } /* * Portable "scandir" function. Ugly but necessary... */ FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l, Fl_File_Sort_F *s = fl_numericsort); FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n); /* * Generic function to open a Uniform Resource Identifier (URI) using a * system-defined program (added in FLTK 1.1.8) */ FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0, int msglen = 0); FL_EXPORT void fl_decode_uri(char *uri); # endif /* __cplusplus */ /* * Note: FLTK 1.0.x compatibility definitions (FLTK_1_0_COMPAT) dropped in 1.4.0 */ #endif /* FL_FILENAME_H */ /** @} */ ================================================ FILE: Game Trainers/common/include/FL/fl_ask.H ================================================ // // Standard dialog header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file fl_ask.H API for common dialogs. */ #ifndef _FL_fl_ask_H_ #define _FL_fl_ask_H_ #include #include #if (FLTK_USE_STD) #include #endif class Fl_Widget; /** Defines the different system beeps available. Some systems may play different sounds or use different sound volume depending on the Fl_Beep value. The implementation is platform dependent. \sa fl_beep(int) */ enum Fl_Beep { FL_BEEP_DEFAULT = 0, ///< Default beep. FL_BEEP_MESSAGE, ///< Message beep. FL_BEEP_ERROR, ///< Error beep. FL_BEEP_QUESTION, ///< Question beep. FL_BEEP_PASSWORD, ///< Password beep. FL_BEEP_NOTIFICATION ///< Notification beep. }; FL_EXPORT void fl_beep(int type = FL_BEEP_DEFAULT); FL_EXPORT void fl_message(const char *, ...) __fl_attr((__format__(__printf__, 1, 2))); FL_EXPORT void fl_alert(const char *, ...) __fl_attr((__format__(__printf__, 1, 2))); // fl_ask() is deprecated since it uses "Yes" and "No" for the buttons, // which does not conform to the current FLTK Human Interface Guidelines. // Use fl_choice() or fl_choice_n() with the appropriate verbs instead. FL_EXPORT int fl_ask(const char *, ...) __fl_attr((__format__(__printf__, 1, 2), __deprecated__)); FL_EXPORT int fl_choice(const char *q, const char *b0, const char *b1, const char *b2, ...) __fl_attr((__format__(__printf__, 1, 5))); FL_EXPORT const char *fl_input(const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 1, 3))); FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 1, 3))); // since FLTK 1.3.8: // - fl_choice_n() with extended return value (-2, -1, 0, 1, 2) FL_EXPORT int fl_choice_n(const char *q, const char *b0, const char *b1, const char *b2, ...) __fl_attr((__format__(__printf__, 1, 5))); // since FLTK 1.4.0: with 'maxchar' to limit input size FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); // since FLTK 1.4.0 -- only with option FLTK_USE_STD // - fl_input_str() with limited input size, returns std::string // - fl_password_str() with limited input size, returns std::string #if (FLTK_USE_STD) FL_EXPORT std::string fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); FL_EXPORT std::string fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 3, 5))); FL_EXPORT std::string fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); FL_EXPORT std::string fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 3, 5))); #endif FL_EXPORT Fl_Widget *fl_message_icon(); extern FL_EXPORT Fl_Font fl_message_font_; extern FL_EXPORT Fl_Fontsize fl_message_size_; inline void fl_message_font(Fl_Font f, Fl_Fontsize s) { fl_message_font_ = f; fl_message_size_ = s; } FL_EXPORT void fl_message_hotspot(int enable); FL_EXPORT int fl_message_hotspot(void); // since FLTK 1.4.0: fl_message_position() FL_EXPORT void fl_message_position(const int x, const int y, const int center = 0); FL_EXPORT void fl_message_position(Fl_Widget *widget); FL_EXPORT int fl_message_position(int *x = 0, int *y = 0); /** \see fl_message_position(Fl_Widget *widget). */ inline void fl_message_position(Fl_Widget &widget) { fl_message_position(&widget); } FL_EXPORT void fl_message_title(const char *title); FL_EXPORT void fl_message_title_default(const char *title); FL_EXPORT void fl_message_icon_label(const char *str); // pointers you can use to change FLTK to another language: extern FL_EXPORT const char *fl_no; extern FL_EXPORT const char *fl_yes; extern FL_EXPORT const char *fl_ok; extern FL_EXPORT const char *fl_cancel; extern FL_EXPORT const char *fl_close; #endif // !_FL_fl_ask_H_ ================================================ FILE: Game Trainers/common/include/FL/fl_attr.h ================================================ /* * Function attribute declarations for the Fast Light Tool Kit (FLTK). * * Copyright 1998-2024 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /** \file fl_attr.h This file defines compiler-specific macros */ #ifndef _FL_fl_attr_h_ #define _FL_fl_attr_h_ /** This section lists macros for Doxygen documentation only. The next section will define the actual macros based on the compile used and based on the capabilities of the version of that compiler. */ #ifdef FL_DOXYGEN /** To be used in prototypes with a variable list of arguments. This macro helps detection of mismatches between format string and argument list at compilation time. Usage example: FL/fl_ask.H */ #define __fl_attr(x) /** This macro makes it safe to use the C++11 keyword \c override with older compilers. */ #define FL_OVERRIDE override /** Enclosing a function or method in FL_DEPRECATED marks it as no longer recommended. This macro syntax can not be used if the return type contains a comma, which is not the case in FLTK. \code FL_DEPRECATED("Outdated, don't use", int position()) { return position_; } \endcode */ #define FL_DEPRECATED(msg, func) \ /##*##* \deprecated msg *##/ \ func #else /* FL_DOXYGEN */ // If FL_NO_DEPRECATED is defined FLTK 1.4 can compile 1.3.x code without // issuing several "deprecated" warnings (1.3 "compatibility" mode). // FL_DEPRECATED will be defined as a no-op. // If FL_NO_DEPRECATED is not defined (default) FLTK 1.4 will issue several // "deprecated" warnings depending on the compiler in use: FL_DEPRECATED // will be defined according to the capabilities of the compiler (below). // The definition below this comment must match the one at the end of this file. #if defined(FL_NO_DEPRECATED) #define FL_DEPRECATED(msg, func) func #endif #ifdef __cplusplus /* Declare macros specific to Visual Studio. Visual Studio defines __cplusplus = '199711L' in all its versions which is not helpful for us here. For VS version number encoding see: https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros This document specifies that the macro _MSVC_LANG is defined since "Visual Studio 2015 Update 3" as 201402L (default) and undefined in earlier versions. It can be used to determine the C++ standard as specified by the /std:c++ compiler option: - /std:c++14 201402L (also if /std:c++ is not used) - /std:c++17 201703L - /std:c++20 202002L - /std:c++latest a "higher, unspecified value" (docs of VS 2022) As of this writing (02/2023) _MSVC_LANG is not yet used in this file but it is documented for future use. */ #if defined(_MSC_VER) #if (_MSC_VER >= 1900) // Visual Studio 2015 (14.0) #ifndef FL_OVERRIDE #define FL_OVERRIDE override #endif #endif // Visual Studio 2015 (14.0) #if (_MSC_VER >= 1400) // Visual Studio 2005 (8.0) #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) __declspec(deprecated(msg)) func #endif #endif // Visual Studio 2005 (8.0) #if (_MSC_VER >= 1310) // Visual Studio .NET 2003 (7.1) #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) __declspec(deprecated) func #endif #endif // Visual Studio .NET 2003 (7.1) #endif // Visual Studio /* Declare macros specific to the C++ standard used. Macros may have been declared already in previous sections. */ #if (__cplusplus >= 202002L) // C++20 #endif // C++20 #if (__cplusplus >= 201703L) // C++17 #endif // C++17 #if (__cplusplus >= 201402L) // C++14 #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) [[deprecated(msg)]] func #endif #endif // C++14 #if (__cplusplus >= 201103L) // C++11 #ifndef FL_OVERRIDE #define FL_OVERRIDE override #endif #endif // C+11 #if (__cplusplus >= 199711L) // C++89 #endif // C++89 #endif // __cplusplus /* Declare macros specific to clang Macros may have been declared already in previous sections. */ #if defined(__clang__) #define FL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) // -- nothing yet -- #endif /* __clang__ */ /* Declare macros specific to gcc. Macros may have been declared already in previous sections. */ #if defined(__GNUC__) #define FL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #ifndef __fl_attr #define __fl_attr(x) __attribute__ (x) #endif #if FL_GCC_VERSION > 40500 /* gcc 4.5.0 */ #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) func __attribute__((deprecated(msg))) #endif #endif /* gcc 4.5.0 */ #if FL_GCC_VERSION >= 30400 /* gcc 3.4.0 */ #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) func __attribute__((deprecated)) #endif #endif /* gcc 3.4.0 */ #endif /* __GNUC__ */ /* If a macro was not defined in any of the sections above, set it to no-op here. */ #ifndef __fl_attr #define __fl_attr(x) #endif #ifndef FL_OVERRIDE #define FL_OVERRIDE #endif #ifndef FL_DEPRECATED #define FL_DEPRECATED(msg, func) func #endif #endif /* FL_DOXYGEN */ #endif /* !_FL_fl_attr_h_ */ ================================================ FILE: Game Trainers/common/include/FL/fl_callback_macros.H ================================================ /* * Macros for easy callbacks for the Fast Light Tool Kit (FLTK). * * Copyright 2023 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ #ifndef _FL_FL_CALLBACK_MACROS_H_ #define _FL_FL_CALLBACK_MACROS_H_ #include /** \file fl_callback_macros.H This file provides macros for easy function and method callbacks with multiple type safe arguments. */ #ifdef FL_DOXYGEN /** \brief Declare a C function callback with custom parameters. You can declare a plain C function callback or a static method callback with custom parameters using this macro. It simplifies the process of calling arbitrary functions with up to five custom parameters. The macro generates code that ensures type safety and expands FLTK's standard callbacks, which are limited to a single `void*` or `long` argument. To use the macro, you provide the widget that will handle the callback as the first argument. The second argument can be either a regular function or a static method in any class. Following these arguments, you can include up to five pairs, where each pair consists of a type and a value. For example, `int, 3` specifies an integer parameter with a value of 3. If you need to pass two arguments, you can use two pairs, like this: `int, 3, int, 4`. The last digit of the macro name must be the same as the number of pairs (0..5) Whenever the code generated by the macro is called, the custom parameters are duplicated and marked for automatic deallocation using `delete` when the callback widget is destroyed. \code{.cpp} #include ... Fl_Button *btn1 = new Fl_Button(10, 10, 100, 20, "Beep"); FL_FUNCTION_CALLBACK_0(btn1, fl_beep); ... Fl_Button *btn2 = new Fl_Button(10, 40, 100, 20, "Hello"); FL_FUNCTION_CALLBACK_5(btn2, fl_message, const char *, "Hello\n%d %d %d %d", int, 1, int, 2, int, 3, int, 4 ); \endcode You can find a small demonstration program showcasing the usage of `FL_*_CALLBACK_*` in the `examples/callbacks.cxx` file. \param WIDGET the widget that will call the callback \param FUNC a C/C++ function or a static class method \param TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2 a list of zero to five type/value pairs, all separated by commas \see FL_METHOD_CALLBACK_1, FL_INLINE_CALLBACK_2 */ #define FL_FUNCTION_CALLBACK_3(WIDGET, FUNC, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2) /** \brief Declare a non-static class method callback with custom parameters. You can declare a callback for a non-static class method with custom parameters using this macro. It provides a convenient way to call arbitrary methods in any class, overcoming FLTK's limitation of passing only a single `void*` or `long` argument. Furthermore, it ensures type safety. The first argument of the macro specifies the widget that will handle the callback. The second argument indicates the class type to be called. The third argument must be a pointer to an instance of that class. The fourth argument is the name of the method within the class. That method must be public and should not be static. Following these arguments, you can include up to five pairs, where each pair consists of a type and a value. For example, `int, 3` specifies an integer parameter with a value of 3. If you need to pass two arguments, you can use two pairs, like this: `int, 3, int, 4`. The last digit of the macro name must be the same as the number of pairs (0..5) Whenever the code generated by the macro is called, the custom parameters are duplicated and marked for automatic deallocation using `delete` when the callback widget is destroyed. \code{.cpp} #include ... Fl_Button *btn = new Fl_Button(10, 10, 100, 20, "Test"); FL_METHOD_CALLBACK_1(btn, Fl_Button, btn, color, Fl_Color, FL_GREEN); \endcode You can find a small demonstration program showcasing the usage of `FL_*_CALLBACK_*` in the `examples/callbacks.cxx` file. \param WIDGET the widget that will call the callback \param CLASS the class type \param SELF a pointer to an instance of the class \param METH a C++ class method that must be public and not static \param TYPE0, VALUE0 a list of zero to five type/value pairs, all separated by commas \see FL_FUNCTION_CALLBACK_3, FL_INLINE_CALLBACK_2 */ #define FL_METHOD_CALLBACK_1(WIDGET, CLASS, SELF, METH, TYPE0, VALUE0) /** \brief Creates code to declare a callback function in line with instantiating a widget. You can use this macro to create a function as a callback, allowing you to define the callback function right where the widget and callback are declared, similar to a Lambda function. The first argument of the macro specifies the widget that will handle the callback. Next, you can include up to five triplets, where each triplet consists of a type, a parameter name, and a value. For example, `int, x, 3` specifies an integer parameter with a value of 3. If you need to pass two arguments, you can use two triplets, such as `int, x, 3, int, y, 4`. The last digit of the macro name must be the same as the number of triplets (0..5). The last argument is the actual function body itself. The function body is limited to a syntax that the macro preprocessor can handle. It should include the leading '{' and trailing '}' and may contain local variable declarations, use global variables and functions, and use also the variables listed and initialized in the argument triples of the macro. Very large function bodies should be avoided because they may exceed the admissible size of a macro argument. Whenever the code generated by the macro is called, the custom parameters are duplicated and marked for automatic deallocation using `delete` when the callback widget is destroyed. \code{.cpp} #include ... Fl_Button *btn = new Fl_Button(10, 10, 100, 20, "Test"); FL_INLINE_CALLBACK_1(btn, const char *, name, btn->label(), { fl_message("Greetings from the %s button", name); } ); \endcode You can find a small demonstration program showcasing the usage of `FL_*_CALLBACK_*` in the `examples/callbacks.cxx` file. \param WIDGET the widget that will call the callback \param TYPE0 the type of the first parameter in the function call \param NAME0 an arbitrary variable name that can be used as a parameter in the function body \param VALUE0 a constant value or a variable; the value of the variable is copied when the callback is created \param TYPE1, NAME1, VALUE1 as above; there are six macros that support 0 to 5 parameters \param LAMBDA the function body within the limits of the C macro preprocessor \see FL_METHOD_CALLBACK_1, FL_FUNCTION_CALLBACK_3 */ #define FL_INLINE_CALLBACK_2(WIDGET, TYPE0, NAME0, VALUE0, TYPE1, NAME1, VALUE1, LAMBDA) #else // FL_DOXYGEN /* These two macros make it possible to call macros with names that are created by concatenating the name in x and (in this context) the number in y. */ #define _FL_CBD_CONCAT_IMPL(x, y) x##y #define _FL_CBD_CONCAT(x, y) _FL_CBD_CONCAT_IMPL(x, y) /* Create a unique name for the derived class based on the current source code line number. */ #define _FL_CBD_CLASS_NAME _FL_CBD_CONCAT(Fl_Callback_User_Data_,__LINE__) /* These macros create boilerplate code for callbacks to functions and static class methods with up to five arguments. This macro invocation for example ``` FL_FUNCTION_CALLBACK_2( func_cb_btn_2, hello_2_args_cb, const char *, text, "FLTK", int, number, 2 ); ``` will generate the following code: ``` do { class Fl_Callback_User_Data_92 : public Fl_Callback_User_Data { public: const char * p0_; int p1_; static void cb(Fl_Widget *w, void *user_data) { Fl_Callback_User_Data_92 *d = (Fl_Callback_User_Data_92*)user_data; hello_2_args_cb(d->p0_, d->p1_); }; Fl_Callback_User_Data_92(const char * p0, int p1) : p0_(p0), p1_(p1) { } }; func_cb_btn_2->callback(Fl_Callback_User_Data_92::cb, new Fl_Callback_User_Data_92("FLTK", 2), true); } while(0) ``` Clicking the Fl_Button `func_cb_btn_2` will call `hello_2_args_cb("FLTK", 2)`. Deleting the button will also delete the data that was created in our boilerplate code. */ #define FL_FUNCTION_CALLBACK_5(WIDGET, FUNC, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; TYPE4 p4_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ FUNC(d->p0_, d->p1_, d->p2_, d->p3_, d->p4_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3, TYPE4 p4) \ : p0_(p0), p1_(p1), p2_(p2), p3_(p3), p4_(p4) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2, VALUE3, VALUE4), true); \ } while(0) #define FL_FUNCTION_CALLBACK_4(WIDGET, FUNC, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ FUNC(d->p0_, d->p1_, d->p2_, d->p3_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3) \ : p0_(p0), p1_(p1), p2_(p2), p3_(p3) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2, VALUE3), true); \ } while(0) #define FL_FUNCTION_CALLBACK_3(WIDGET, FUNC, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ FUNC(d->p0_, d->p1_, d->p2_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2) \ : p0_(p0), p1_(p1), p2_(p2) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2), true); \ } while(0) #define FL_FUNCTION_CALLBACK_2(WIDGET, FUNC, TYPE0, VALUE0, TYPE1, VALUE1) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ FUNC(d->p0_, d->p1_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1) \ : p0_(p0), p1_(p1) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1), true); \ } while(0) #define FL_FUNCTION_CALLBACK_1(WIDGET, FUNC, TYPE0, VALUE0) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ FUNC(d->p0_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0) \ : p0_(p0) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0), true); \ } while(0) #define FL_FUNCTION_CALLBACK_0(WIDGET, FUNC) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ static void cb(Fl_Widget *w, void *user_data) { \ FUNC(); \ }; \ _FL_CBD_CLASS_NAME() { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(), true); \ } while(0) /* These macros create boilerplate code for callbacks to class methods with up to five arguments. This macro invocation for example ``` FL_METHOD_CALLBACK_4(btn, MyWindow, win, resize, int, test_x+10, int, test_y+10, int, 320, int, 400); ``` will generate the following code: ``` do { class Fl_Callback_User_Data_73 : public Fl_Callback_User_Data { public: int p0_; int p1_; int p2_; int p3_; MyWindow *self_; static void cb(Fl_Widget *w, void *user_data) { Fl_Callback_User_Data_73 *d = (Fl_Callback_User_Data_73*)user_data; d->self_->resize(d->p0_, d->p1_, d->p2_, d->p3_); }; Fl_Callback_User_Data_73(MyWindow *self, int p0, int p1, int p2, int p3) : self_(self), p0_(p0), p1_(p1), p2_(p2), p3_(p3) { } }; btn->callback(Fl_Callback_User_Data_73::cb, new Fl_Callback_User_Data_73(win, test_x+10, test_y+10, 320, 400), true); } while(0); ``` Clicking the Fl_Button `btn` will call `win->resize(test_x+10, test_y+10, 320, 400);`. Deleting the button will also delete the data that was created in our boilerplate code. */ #define FL_METHOD_CALLBACK_5(WIDGET, CLASS, SELF, METHOD, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; TYPE4 p4_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(d->p0_, d->p1_, d->p2_, d->p3_, d->p4_); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self, TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3, TYPE4 p4) \ : self_(self), p0_(p0), p1_(p1), p2_(p2), p3_(p3), p4_(p4) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF, VALUE0, VALUE1, VALUE2, VALUE3, VALUE4), true); \ } while(0) #define FL_METHOD_CALLBACK_4(WIDGET, CLASS, SELF, METHOD, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(d->p0_, d->p1_, d->p2_, d->p3_); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self, TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3) \ : self_(self), p0_(p0), p1_(p1), p2_(p2), p3_(p3) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF, VALUE0, VALUE1, VALUE2, VALUE3), true); \ } while(0) #define FL_METHOD_CALLBACK_3(WIDGET, CLASS, SELF, METHOD, TYPE0, VALUE0, TYPE1, VALUE1, TYPE2, VALUE2) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(d->p0_, d->p1_, d->p2_); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self, TYPE0 p0, TYPE1 p1, TYPE2 p2) \ : self_(self), p0_(p0), p1_(p1), p2_(p2) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF, VALUE0, VALUE1, VALUE2), true); \ } while(0) #define FL_METHOD_CALLBACK_2(WIDGET, CLASS, SELF, METHOD, TYPE0, VALUE0, TYPE1, VALUE1) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ TYPE0 p0_; TYPE1 p1_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(d->p0_, d->p1_); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self, TYPE0 p0, TYPE1 p1) \ : self_(self), p0_(p0), p1_(p1) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF, VALUE0, VALUE1), true); \ } while(0) #define FL_METHOD_CALLBACK_1(WIDGET, CLASS, SELF, METHOD, TYPE0, VALUE0) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ TYPE0 p0_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(d->p0_); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self, TYPE0 p0) \ : self_(self), p0_(p0) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF, VALUE0), true); \ } while(0) #define FL_METHOD_CALLBACK_0(WIDGET, CLASS, SELF, METHOD) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ CLASS *self_; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ d->self_->METHOD(); \ }; \ _FL_CBD_CLASS_NAME(CLASS *self) \ : self_(self) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(SELF), true); \ } while(0) /* These macros create boilerplate code for callback functions inlined into the widget creation code (similar to lambda functions in C++11 and up) with up to five arguments. This macro invocation for example ``` FL_INLINE_CALLBACK_2( // callback has two parameters btn, // attach callback to this button const char *, text, "FLTK", // first parameter (type, name, value) int, number, 2, // second parameter { // function body fl_message("We received the message %s with %d!", text, number); } ); ``` will generate the following code: ``` do { class Fl_Callback_User_Data_133 : public Fl_Callback_User_Data { public: const char * p0_; // store first parameter here int p1_; // store second parameter here // lambda style function static void fn(const char * text, int number ) { fl_message("We received the message %s with %d!", text, number); }; // FLTK style callback static void cb(Fl_Widget *w, void *user_data) { Fl_Callback_User_Data_133 *d = (Fl_Callback_User_Data_133*)user_data; fn(d->p0_, d->p1_); }; // class constructor Fl_Callback_User_Data_133(const char * p0, int p1) : p0_(p0), // copy parameter 0 p1_(p1) // copy parameter 1 { } // constructor body }; // connect our class to the widget callback btn->callback(Fl_Callback_User_Data_133::cb, new Fl_Callback_User_Data_133("FLTK", 2), true); } while(0); // user code adds semicolon ``` Clicking the Fl_Button `btn` will call `fl_message("We received the message %s with %d!", "FLTK", 2);`. Deleting the button will also delete the data that was created in our boilerplate code. */ #define FL_INLINE_CALLBACK_5(WIDGET, TYPE0, NAME0, VALUE0, TYPE1, NAME1, VALUE1, TYPE2, NAME2, VALUE2, TYPE3, NAME3, VALUE3, TYPE4, NAME4, VALUE4, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; TYPE4 p4_; \ static void fn(TYPE0 NAME0, TYPE1 NAME1, TYPE2 NAME2, TYPE3 NAME3, TYPE4 NAME4) \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ _FL_CBD_CLASS_NAME::fn(d->p0_, d->p1_, d->p2_, d->p3_, d->p4_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3, TYPE4 p4) \ : p0_(p0), p1_(p1), p2_(p2), p3_(p3), p4_(p4) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2, VALUE3, VALUE4), true); \ } while(0) #define FL_INLINE_CALLBACK_4(WIDGET, TYPE0, NAME0, VALUE0, TYPE1, NAME1, VALUE1, TYPE2, NAME2, VALUE2, TYPE3, NAME3, VALUE3, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; TYPE3 p3_; \ static void fn(TYPE0 NAME0, TYPE1 NAME1, TYPE2 NAME2, TYPE3 NAME3) \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ _FL_CBD_CLASS_NAME::fn(d->p0_, d->p1_, d->p2_, d->p3_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2, TYPE3 p3) \ : p0_(p0), p1_(p1), p2_(p2), p3_(p3) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2, VALUE3), true); \ } while(0) #define FL_INLINE_CALLBACK_3(WIDGET, TYPE0, NAME0, VALUE0, TYPE1, NAME1, VALUE1, TYPE2, NAME2, VALUE2, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; TYPE2 p2_; \ static void fn(TYPE0 NAME0, TYPE1 NAME1, TYPE2 NAME2) \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ _FL_CBD_CLASS_NAME::fn(d->p0_, d->p1_, d->p2_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1, TYPE2 p2) \ : p0_(p0), p1_(p1), p2_(p2) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1, VALUE2), true); \ } while(0) #define FL_INLINE_CALLBACK_2(WIDGET, TYPE0, NAME0, VALUE0, TYPE1, NAME1, VALUE1, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; TYPE1 p1_; \ static void fn(TYPE0 NAME0, TYPE1 NAME1) \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ _FL_CBD_CLASS_NAME::fn(d->p0_, d->p1_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0, TYPE1 p1) \ : p0_(p0), p1_(p1) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0, VALUE1), true); \ } while(0) #define FL_INLINE_CALLBACK_1(WIDGET, TYPE0, NAME0, VALUE0, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ TYPE0 p0_; \ static void fn(TYPE0 NAME0) \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME *d = (_FL_CBD_CLASS_NAME*)user_data; \ _FL_CBD_CLASS_NAME::fn(d->p0_); \ }; \ _FL_CBD_CLASS_NAME(TYPE0 p0) \ : p0_(p0) { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(VALUE0), true); \ } while(0) #define FL_INLINE_CALLBACK_0(WIDGET, LAMBDA) \ do { \ class _FL_CBD_CLASS_NAME : public Fl_Callback_User_Data { \ public: \ static void fn() \ LAMBDA; \ static void cb(Fl_Widget *w, void *user_data) { \ _FL_CBD_CLASS_NAME::fn(); \ }; \ _FL_CBD_CLASS_NAME() { }; \ }; \ WIDGET->callback(_FL_CBD_CLASS_NAME::cb, new _FL_CBD_CLASS_NAME(), true); \ } while(0) #endif // FL_DOXYGEN #endif /* !_FL_FL_CALLBACK_MACROS_H_ */ ================================================ FILE: Game Trainers/common/include/FL/fl_casts.H ================================================ // // Experimental inline "cast functions" for the Fast Light Toolkit (FLTK). // See also issue #109: "VS2017 warnings when building fltk 1.4.x" // // Copyright 1998-2021 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef _FL_fl_casts_H_ #define _FL_fl_casts_H_ #include inline char fl_char(void *v) { return (char)(fl_intptr_t)v; } inline int fl_int(void *v) { return (int)(fl_intptr_t)v; } inline long fl_long(void *v) { return (long)(fl_intptr_t)v; } inline unsigned char fl_uchar(void *v) { return (unsigned char)(fl_uintptr_t)v; } inline unsigned int fl_uint(void *v) { return (unsigned int)(fl_uintptr_t)v; } inline unsigned long fl_ulong(void *v) { return (unsigned long)(fl_uintptr_t)v; } // the following conversions can be used to silence MSVC warning C4312: // 'type cast': conversion from '' to 'void *' of greater size inline void *fl_voidptr(int v) { return (void *)(fl_intptr_t)v; } inline void *fl_voidptr(unsigned int v) { return (void *)(fl_uintptr_t)v; } inline void *fl_voidptr(long v) { return (void *)(fl_intptr_t)v; } inline void *fl_voidptr(unsigned long v) { return (void *)(fl_uintptr_t)v; } #endif /* _FL_fl_casts_H_ */ ================================================ FILE: Game Trainers/common/include/FL/fl_config.h ================================================ /* FL/fl_config.h. Generated from fl_config.cmake.in by CMake. */ /* * Build configuration file for the Fast Light Tool Kit (FLTK). * * Copyright 1998-2024 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ #ifndef _FL_fl_config_h_ #define _FL_fl_config_h_ /* * FL_ABI_VERSION (ABI version) * * define FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero) */ /* #undef FL_ABI_VERSION */ /* * FLTK_HAVE_CAIRO * * Do we have the Cairo library available? */ /* #undef FLTK_HAVE_CAIRO */ /* * FLTK_HAVE_CAIROEXT * * Do we have the Cairo library available and want extended Cairo use in FLTK ? * This implies to link cairo.lib in all FLTK based apps. */ /* #undef FLTK_HAVE_CAIROEXT */ /* * FLTK_HAVE_FORMS * * Do we have the Forms compatibility library available? */ #define FLTK_HAVE_FORMS 1 /* * FLTK_USE_X11 * * Do we use X11 for the current platform? * */ /* #undef FLTK_USE_X11 */ /* * FLTK_USE_CAIRO * * Do we use Cairo to draw to the display? * */ /* #undef FLTK_USE_CAIRO */ /* * FLTK_USE_WAYLAND * * Do we use Wayland for the current platform? * */ /* #undef FLTK_USE_WAYLAND */ /* * FLTK_USE_STD * * May we use std::string and std::vector for the current build? * * This is a build configuration option which allows FLTK to add some * features based on std::string and std::vector in FLTK 1.4.x * */ #define FLTK_USE_STD 1 /* * FLTK_USE_SVG * * Do we want FLTK to read and write SVG-formatted files ? * */ #define FLTK_USE_SVG 1 #endif /* _FL_fl_config_h_ */ ================================================ FILE: Game Trainers/common/include/FL/fl_draw.H ================================================ // // Portable drawing function header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file fl_draw.H \brief utility header to pull drawing functions together */ #ifndef fl_draw_H #define fl_draw_H #include // color names #include // fl_graphics_driver + Fl_Region #include // Image class... class Fl_Image; class Fl_Window; // Label flags... FL_EXPORT extern char fl_draw_shortcut; /** \addtogroup fl_attributes @{ */ // Colors: /** Set the color for all subsequent drawing operations. For color-mapped displays, a color cell will be allocated out of \p fl_colormap the first time you use a color. If the colormap fills up then a least-squares algorithm is used to find the closest color. If no valid graphical context (fl_gc) is available, the foreground is not set for the current window. \param[in] c color */ inline void fl_color(Fl_Color c) { fl_graphics_driver->color(c); } // select indexed color /** for back compatibility - use fl_color(Fl_Color c) instead */ inline void fl_color(int c) { fl_color((Fl_Color)c); } /** Set the color for all subsequent drawing operations. The closest possible match to the RGB color is used. The RGB color is used directly on TrueColor displays. For colormap visuals the nearest index in the gray ramp or color cube is used. If no valid graphical context (fl_gc) is available, the foreground is not set for the current window. \param[in] r,g,b color components */ inline void fl_color(uchar r, uchar g, uchar b) { fl_graphics_driver->color(r, g, b); } /** Return the last fl_color() that was set. This can be used for state save/restore. */ inline Fl_Color fl_color() { return fl_graphics_driver->color(); } /** @} */ /** \addtogroup fl_drawings @{ */ // clip: /** Intersect the current clip region with a rectangle and push this new region onto the stack. \param[in] x,y,w,h position and size */ inline void fl_push_clip(int x, int y, int w, int h) { fl_graphics_driver->push_clip(x, y, w, h); } /** Intersect the current clip region with a rectangle and push this new region onto the stack (deprecated). \param[in] x,y,w,h position and size \deprecated Please use fl_push_clip(int x, int y, int w, int h) instead. fl_clip(int, int, int, int) will be removed in FLTK 1.5. */ inline void fl_clip(int x, int y, int w, int h) { fl_graphics_driver->push_clip(x, y, w, h); } /** Push an empty clip region onto the stack so nothing will be clipped. */ inline void fl_push_no_clip() { fl_graphics_driver->push_no_clip(); } /** Restore the previous clip region. You must call fl_pop_clip() once for every time you call fl_push_clip(). Unpredictable results may occur if the clip stack is not empty when you return to FLTK. */ inline void fl_pop_clip() { fl_graphics_driver->pop_clip(); } /** Does the rectangle intersect the current clip region? \param[in] x,y,w,h position and size of rectangle \returns non-zero if any of the rectangle intersects the current clip region. If this returns 0 you don't have to draw the object. \note Under X this returns 2 if the rectangle is partially clipped and 1 if it is entirely inside the clip region. \see fl_clip_box() */ inline int fl_not_clipped(int x, int y, int w, int h) { return fl_graphics_driver->not_clipped(x, y, w, h); } /** Intersect a rectangle with the current clip region and return the bounding box of the result. Returns non-zero if the resulting rectangle is different to the original. The given rectangle (x, y, w, h) \e should be entirely inside its window, otherwise the result may be unexpected, i.e. this function \e may not clip the rectangle to the window coordinates and size. In particular \p x and \p y \e should not be negative. The resulting bounding box can be used to limit the necessary drawing to this rectangle. Example: \code void MyGroup::draw() { int X = 0, Y = 0, W = 0, H = 0; int ret = fl_clip_box(x(), y(), w(), h(), X, Y, W, H); if (ret == 0) { // entire group is visible (not clipped) // full drawing code here } else { // parts of this group are clipped // partial drawing code here (uses X, Y, W, and H to test) } } \endcode \p W and \p H are set to zero if the rectangle is completely outside the clipping region. In this case \p X and \p Y are undefined and should not be used. Possible values are (0, 0), (x, y), or anything else (platform dependent). \note This function is platform-dependent. If the given rectangle is not entirely inside the window, the results are not guaranteed to be the same on all platforms. \param[in] x,y,w,h position and size of rectangle \param[out] X,Y,W,H position and size of resulting bounding box. \returns Non-zero if the resulting rectangle is different to the original. \see fl_not_clipped() */ inline int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H) { return fl_graphics_driver->clip_box(x, y, w, h, X, Y, W, H); } /** Undo any clobbering of the clip region done by your program. */ inline void fl_restore_clip() { fl_graphics_driver->restore_clip(); } /** Replace the top of the clipping stack with a clipping region of any shape. Fl_Region is an operating system specific type. \note This function is mostly intended for internal use by the FLTK library when drawing to the display. Its effect can be null if the current drawing surface is not the display. \param[in] r clipping region */ inline void fl_clip_region(Fl_Region r) { fl_graphics_driver->clip_region(r); } /** Return the current clipping region. \note This function is mostly intended for internal use by the FLTK library when drawing to the display. Its return value can be always NULL if the current drawing surface is not the display. */ inline Fl_Region fl_clip_region() { return fl_graphics_driver->clip_region(); } // points: /** Draw a single pixel at the given coordinates */ inline void fl_point(int x, int y) { fl_graphics_driver->point(x, y); } // line type: /** Set how to draw lines (the "pen"). If you change this it is your responsibility to set it back to the default using \c fl_line_style(0). \image html fl_line_style.png "fl_line_style() styles" \image latex fl_line_style.png "fl_line_style() styles" width=12cm \param[in] style A bitmask which is a bitwise-OR of \ref LineStyles "Line Styles", a cap style, and a join style. If you don't specify a dash type you will get a solid line. If you don't specify a cap or join type you will get a system-defined default of whatever value is fastest. \param[in] width The thickness of the lines in pixels. Zero results in the system defined default, which on both X and Windows is somewhat different and nicer than 1. \param[in] dashes A pointer to an array of dash lengths, measured in pixels. The first location is how long to draw a solid portion, the next is how long to draw the gap, then the solid, etc. It is terminated with a zero-length entry. A \c NULL pointer or a zero-length array results in a solid line. Odd array sizes are not supported and result in undefined behavior. \note Because of how line styles are implemented on Win32 systems, you \e must set the line style \e after setting the drawing color. If you set the color after the line style you will lose the line style settings. \note The \p dashes array does not work under the (unsupported!) operating systems Windows 95, 98 or Me, since those operating systems do not support complex line styles. */ inline void fl_line_style(int style, int width = 0, char *dashes = 0) { fl_graphics_driver->line_style(style, width, dashes); } /// \anchor LineStyles /// /// \image html fl_line_style.png "fl_line_style() styles" /// \image latex fl_line_style.png "fl_line_style() styles" width=12cm /// enum { FL_SOLID = 0, ///< line style: solid line FL_DASH = 1, ///< line style: 75% dashed line FL_DOT = 2, ///< line style: 50% pixel dotted FL_DASHDOT = 3, ///< line style: dash / dot pattern FL_DASHDOTDOT = 4, ///< line style: dash / two dot pattern FL_CAP_FLAT = 0x100, ///< cap style: end is flat FL_CAP_ROUND = 0x200, ///< cap style: end is round FL_CAP_SQUARE = 0x300, ///< cap style: end wraps end point FL_JOIN_MITER = 0x1000, ///< join style: line join extends to a point FL_JOIN_ROUND = 0x2000, ///< join style: line join is rounded FL_JOIN_BEVEL = 0x3000 ///< join style: line join is tidied }; /** Turn antialiased line drawings ON or OFF, if supported by platform. Currently, only the Windows platform allows to change whether line drawings are antialiased. Turning it OFF may accelerate heavy drawing operations. */ inline void fl_antialias(int state) { fl_graphics_driver->antialias(state); } /** Return whether line drawings are currently antialiased. */ inline int fl_antialias() { return fl_graphics_driver->antialias(); } // rectangles tweaked to exactly fill the pixel rectangle: /** Draw a border \e inside the given bounding box. This function is meant for quick drawing of simple boxes. The behavior is undefined for line widths that are not 1. */ inline void fl_rect(int x, int y, int w, int h) { fl_graphics_driver->rect(x, y, w, h); } /** Draw a rounded border \e inside the given bounding box. The radius code is optimized for speed and works best for values between 5 and 15 units. */ inline void fl_rounded_rect(int x, int y, int w, int h, int r) { fl_graphics_driver->rounded_rect(x, y, w, h, r); } /** Draw a border \e inside the given bounding box. This is the same as fl_rect(int x, int y, int w, int h) but with Fl_Rect \p r as input argument. */ inline void fl_rect(Fl_Rect r) { fl_rect(r.x(), r.y(), r.w(), r.h()); } /** Draw a dotted rectangle, used to indicate keyboard focus on a widget. This method draws the rectangle in the current color and independent of the Fl::visible_focus() option. You may need to set the current color with fl_color() before you call this. */ inline void fl_focus_rect(int x, int y, int w, int h) { fl_graphics_driver->focus_rect(x, y, w, h); } /** Draw with passed color a border \e inside the given bounding box. \warning The current color is changed to \p c upon return. */ inline void fl_rect(int x, int y, int w, int h, Fl_Color c) { fl_color(c); fl_rect(x, y, w, h); } /** Color with current color a rectangle that exactly fills the given bounding box. */ inline void fl_rectf(int x, int y, int w, int h) { fl_graphics_driver->rectf(x, y, w, h); } /** Color with current color a rounded rectangle that exactly fills the given bounding box. The radius code is optimized for speed and works best for values between 5 and 15 units. */ inline void fl_rounded_rectf(int x, int y, int w, int h, int r) { fl_graphics_driver->rounded_rectf(x, y, w, h, r); } /** Color with passed color a rectangle that exactly fills the given bounding box. \warning The current color is changed to \p c upon return. */ inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) { fl_color(c); fl_rectf(x, y, w, h); } /** Color with current color a rectangle that exactly fills the given bounding box. */ inline void fl_rectf(Fl_Rect r) { fl_graphics_driver->rectf(r.x(), r.y(), r.w(), r.h()); } /** Color with passed color a rectangle that exactly fills the given bounding box. \warning The current color is changed to \p c upon return. */ inline void fl_rectf(Fl_Rect r, Fl_Color c) { fl_color(c); fl_rectf(r); } /** Color a rectangle with "exactly" the passed r,g,b color. On screens with less than 24 bits of color this is done by drawing a solid-colored block using fl_draw_image() so that the correct color shade is produced. On other screens, the current color is changed to \p fl_color(r,g,b) upon return. */ inline void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) { fl_graphics_driver->colored_rectf(x, y, w, h, r, g, b); } /** Color a rectangle with "exactly" the passed r,g,b color. This is the same as fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) but with Fl_Rect \p bb (bounding box) as argument instead of (x, y, w, h). \see fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) */ inline void fl_rectf(Fl_Rect bb, uchar r, uchar g, uchar b) { fl_graphics_driver->colored_rectf(bb.x(), bb.y(), bb.w(), bb.h(), r, g, b); } // line segments: /** Draw a line from (x,y) to (x1,y1) */ inline void fl_line(int x, int y, int x1, int y1) { fl_graphics_driver->line(x, y, x1, y1); } /** Draw a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2) */ inline void fl_line(int x, int y, int x1, int y1, int x2, int y2) { fl_graphics_driver->line(x, y, x1, y1, x2, y2); } // closed line segments: /** Outline a 3-sided polygon with lines */ inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2) { fl_graphics_driver->loop(x, y, x1, y1, x2, y2); } /** Outline a 4-sided polygon with lines */ inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { fl_graphics_driver->loop(x, y, x1, y1, x2, y2, x3, y3); } // filled polygons /** Fill a 3-sided polygon. */ inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) { fl_graphics_driver->polygon(x, y, x1, y1, x2, y2); } /** Fill a 4-sided polygon. The polygon must be convex. */ inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) { fl_graphics_driver->polygon(x, y, x1, y1, x2, y2, x3, y3); } // draw rectilinear lines, horizontal segment first: /** Draw a horizontal line from (x,y) to (x1,y). */ inline void fl_xyline(int x, int y, int x1) { fl_graphics_driver->xyline(x, y, x1); } /** Draw a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2). */ inline void fl_xyline(int x, int y, int x1, int y2) { fl_graphics_driver->xyline(x, y, x1, y2); } /** Draw a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) and then another horizontal from (x1,y2) to (x3,y2). */ inline void fl_xyline(int x, int y, int x1, int y2, int x3) { fl_graphics_driver->xyline(x, y, x1, y2, x3); } // draw rectilinear lines, vertical segment first: /** Draw a vertical line from (x,y) to (x,y1) */ inline void fl_yxline(int x, int y, int y1) { fl_graphics_driver->yxline(x, y, y1); } /** Draw a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1). */ inline void fl_yxline(int x, int y, int y1, int x2) { fl_graphics_driver->yxline(x, y, y1, x2); } /** Draw a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1), then another vertical from (x2,y1) to (x2,y3). */ inline void fl_yxline(int x, int y, int y1, int x2, int y3) { fl_graphics_driver->yxline(x, y, y1, x2, y3); } // circular lines and pie slices (code in fl_arci.C): /** Draw ellipse sections using integer coordinates. These functions match the rather limited circle drawing code provided by X and Windows. The advantage over using fl_arc with floating point coordinates is that they are faster because they often use the hardware, and they draw much nicer small circles, since the small sizes are often hard-coded bitmaps. If a complete circle is drawn it will fit inside the passed bounding box. The two angles are measured in degrees counter-clockwise from 3 o'clock and are the starting and ending angle of the arc, \p a2 must be greater or equal to \p a1. fl_arc() draws a series of lines to approximate the arc. Notice that the integer version of fl_arc() has a different number of arguments than the double version fl_arc(double x, double y, double r, double start, double end) \param[in] x,y,w,h bounding box of complete circle \param[in] a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 o'clock. \p a2 must be greater than or equal to \p a1. \image html fl_pie_arc_diagram.png "fl_pie() and fl_arc()" \image latex fl_pie_arc_diagram.png "fl_pie() and fl_arc()" width=4cm */ inline void fl_arc(int x, int y, int w, int h, double a1, double a2) { fl_graphics_driver->arc(x, y, w, h, a1, a2); } /** Draw filled ellipse sections using integer coordinates. Like fl_arc(), but fl_pie() draws a filled-in pie slice. This slice may extend outside the line drawn by fl_arc(); to avoid this use w - 1 and h - 1. \param[in] x,y,w,h bounding box of complete circle \param[in] a1,a2 start and end angles of arc measured in degrees counter-clockwise from 3 o'clock. \p a2 must be greater than or equal to \p a1. \image html fl_pie_arc_diagram.png "fl_pie() and fl_arc()" \image latex fl_pie_arc_diagram.png "fl_pie() and fl_arc()" width=4cm */ inline void fl_pie(int x, int y, int w, int h, double a1, double a2) { fl_graphics_driver->pie(x, y, w, h, a1, a2); } /** fl_chord declaration is a place holder - the function does not yet exist */ FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi // scalable drawing code (code in fl_vertex.cxx and fl_arc.cxx): /** Save the current transformation matrix on the stack. The maximum depth of the stack is 32. */ inline void fl_push_matrix() { fl_graphics_driver->push_matrix(); } /** Restore the current transformation matrix from the stack. */ inline void fl_pop_matrix() { fl_graphics_driver->pop_matrix(); } /** Concatenate scaling transformation onto the current one. \param[in] x,y scale factors in x-direction and y-direction */ inline void fl_scale(double x, double y) { fl_graphics_driver->mult_matrix(x, 0, 0, y, 0, 0); } /** Concatenate scaling transformation onto the current one. \param[in] x scale factor in both x-direction and y-direction */ inline void fl_scale(double x) { fl_graphics_driver->mult_matrix(x, 0, 0, x, 0, 0); } /** Concatenate translation transformation onto the current one. \param[in] x,y translation factor in x-direction and y-direction */ inline void fl_translate(double x, double y) { fl_graphics_driver->translate(x, y); } /** Concatenate rotation transformation onto the current one. \param[in] d - rotation angle, counter-clockwise in degrees (not radians) */ inline void fl_rotate(double d) { fl_graphics_driver->rotate(d); } /** Set the transformation matrix to identity. */ inline void fl_load_identity() { fl_graphics_driver->load_identity(); } /** Set the current transformation matrix. \param[in] a,b,c,d,x,y transformation matrix elements */ inline void fl_load_matrix(double a, double b, double c, double d, double x, double y) { fl_graphics_driver->load_matrix(a, b, c, d, x, y); } /** Concatenate another transformation onto the current one. \param[in] a,b,c,d,x,y transformation matrix elements such that X' = aX + cY + x and Y' = bX +dY + y */ inline void fl_mult_matrix(double a, double b, double c, double d, double x, double y) { fl_graphics_driver->mult_matrix(a, b, c, d, x, y); } /** Start drawing a list of points. Points are added to the list with fl_vertex(). */ inline void fl_begin_points() { fl_graphics_driver->begin_points(); } /** Start drawing a list of lines. */ inline void fl_begin_line() { fl_graphics_driver->begin_line(); } /** Start drawing a closed sequence of lines. */ inline void fl_begin_loop() { fl_graphics_driver->begin_loop(); } /** Start drawing a convex filled polygon. */ inline void fl_begin_polygon() { fl_graphics_driver->begin_polygon(); } /** Add a single vertex to the current path. \param[in] x,y coordinate */ inline void fl_vertex(double x, double y) { fl_graphics_driver->vertex(x, y); } /** Add a series of points on a Bézier curve to the path. The curve ends (and two of the points) are at X0,Y0 and X3,Y3. \param[in] X0,Y0 curve start point \param[in] X1,Y1 curve control point \param[in] X2,Y2 curve control point \param[in] X3,Y3 curve end point */ inline void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3) { fl_graphics_driver->curve(X0, Y0, X1, Y1, X2, Y2, X3, Y3); } /** Add a series of points to the current path on the arc of a circle. The arc is drawn counter-clockwise from 3 o'clock. If \p end is less than \p start then it draws the arc in a clockwise direction. To draw an arc across the 3 o'clock line, \p start and \p end can be greater than 360 or less than 0. For example, to draw a counter-clockwise arc from 6 to 12 o'clock, \p start would be -90 deg, and \p end would be at +90 deg. You can get elliptical paths by using scale and rotate before calling fl_arc(). \param[in] x, y, r center and radius of circular arc \param[in] start, end angles of start and end of arc measured in degrees \image html fl_arc_xyr_diagram.png "fl_arc(x,y,r,a1,a2)" \image latex fl_arc_xyr_diagram.png "fl_arc(x,y,r,a1,a2)" width=6cm Examples: \code // Draw an arc of points fl_begin_points(); fl_arc(100.0, 100.0, 50.0, 0.0, 180.0); fl_end_points(); // Draw arc with a line fl_begin_line(); fl_arc(200.0, 100.0, 50.0, 0.0, 180.0); fl_end_line(); // Draw filled arc fl_begin_polygon(); fl_arc(300.0, 100.0, 50.0, 0.0, 180.0); fl_end_polygon(); \endcode */ inline void fl_arc(double x, double y, double r, double start, double end) { fl_graphics_driver->arc(x, y, r, start, end); } /** fl_circle(x,y,r) is equivalent to fl_arc(x,y,r,0,360), but may be faster. \param[in] x,y,r center and radius of circle \note fl_circle() is best used as part of the \ref drawing_complex API, that is, flanked by fl_begin_XXX() and fl_end_XXX() calls where XXX can be 'loop' or 'polygon' to draw, respectively a circle or a disk. Transformation functions (e.g., fl_scale(double, double)) can be also used for fl_circle() to draw empty of filled ellipses. It must be the \e only thing in the path: if you want a circle as part of a complex polygon you must use fl_arc().
    Nevertheless, fl_circle() can also be used by itself to draw circles. */ inline void fl_circle(double x, double y, double r) { fl_graphics_driver->circle(x, y, r); } /** End list of points, and draw. */ inline void fl_end_points() { fl_graphics_driver->end_points(); } /** End list of lines, and draw. */ inline void fl_end_line() { fl_graphics_driver->end_line(); } /** End closed sequence of lines, and draw. */ inline void fl_end_loop() { fl_graphics_driver->end_loop(); } /** End convex filled polygon, and draw. */ inline void fl_end_polygon() { fl_graphics_driver->end_polygon(); } /** Start drawing a complex filled polygon. The polygon may be concave, may have holes in it, or may be several disconnected pieces. Call fl_gap() to separate loops of the path. To outline the polygon, use fl_begin_loop() and replace each fl_gap() with fl_end_loop();fl_begin_loop() pairs. \note For portability, you should only draw polygons that appear the same whether "even/odd" or "non-zero" winding rules are used to fill them. Holes should be drawn in the opposite direction to the outside loop. */ inline void fl_begin_complex_polygon() { fl_graphics_driver->begin_complex_polygon(); } /** Separate loops of the path. It is unnecessary but harmless to call fl_gap() before the first vertex, after the last vertex, or several times in a row. */ inline void fl_gap() { fl_graphics_driver->gap(); } /** End complex filled polygon, and draw. */ inline void fl_end_complex_polygon() { fl_graphics_driver->end_complex_polygon(); } // get and use transformed positions: /** Transform coordinate using the current transformation matrix. \param[in] x,y coordinate */ inline double fl_transform_x(double x, double y) { return fl_graphics_driver->transform_x(x, y); } /** Transform coordinate using the current transformation matrix. \param[in] x,y coordinate */ inline double fl_transform_y(double x, double y) { return fl_graphics_driver->transform_y(x, y); } /** Transform distance using current transformation matrix. \param[in] x,y coordinate */ inline double fl_transform_dx(double x, double y) { return fl_graphics_driver->transform_dx(x, y); } /** Transform distance using current transformation matrix. \param[in] x,y coordinate */ inline double fl_transform_dy(double x, double y) { return fl_graphics_driver->transform_dy(x, y); } /** Add coordinate pair to the vertex list without further transformations. \param[in] xf,yf transformed coordinate */ inline void fl_transformed_vertex(double xf, double yf) { fl_graphics_driver->transformed_vertex(xf, yf); } /** Copy a rectangular area of the given offscreen buffer into the current drawing destination. \param x,y position where to draw the copied rectangle \param w,h size of the copied rectangle \param pixmap offscreen buffer containing the rectangle to copy \param srcx,srcy origin in offscreen buffer of rectangle to copy */ inline void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { fl_graphics_driver->copy_offscreen(x, y, w, h, pixmap, srcx, srcy); } FL_EXPORT Fl_Offscreen fl_create_offscreen(int w, int h); FL_EXPORT void fl_begin_offscreen(Fl_Offscreen b); FL_EXPORT void fl_end_offscreen(void); FL_EXPORT void fl_delete_offscreen(Fl_Offscreen bitmap); FL_EXPORT void fl_rescale_offscreen(Fl_Offscreen &ctx); /** @} */ /** \addtogroup fl_attributes @{ */ /* NOTE: doxygen comments here to avoid triplication in os-specific sources */ // Fonts: /* Set the current font, which is then used in various drawing routines. Implemented and documented in src/fl_draw.cxx */ FL_EXPORT void fl_font(Fl_Font face, Fl_Fontsize fsize); /** Return the \p face set by the most recent call to fl_font(). This can be used to save/restore the font. */ inline Fl_Font fl_font() { return fl_graphics_driver->font(); } /** Return the \p size set by the most recent call to fl_font(). This can be used to save/restore the font. */ inline Fl_Fontsize fl_size() { return fl_graphics_driver->size(); } // Information you can get about the current font: /** Return the recommended minimum line spacing for the current font. You can also use the value of \p size passed to fl_font(). */ inline int fl_height() { return fl_graphics_driver->height(); } FL_EXPORT int fl_height(int font, int size); /** Return the recommended distance above the bottom of a fl_height() tall box to draw the text at so it looks centered vertically in that box. */ inline int fl_descent() { return fl_graphics_driver->descent(); } /** Return the typographical width of a nul-terminated string using the current font face and size. */ FL_EXPORT double fl_width(const char *txt); /** Return the typographical width of a sequence of \p n characters using the current font face and size. */ inline double fl_width(const char *txt, int n) { return fl_graphics_driver->width(txt, n); } /** Return the typographical width of a single character using the current font face and size. \note If a valid fl_gc is NOT found then it uses the first window gc, or the screen gc if no fltk window is available when called. */ inline double fl_width(unsigned int c) { return fl_graphics_driver->width(c); } /** Determine the minimum pixel dimensions of a nul-terminated string using the current fl_font(). Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho) such that a bounding box that exactly fits around the text could be drawn with fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first "colored in" pixel of the string, from the draw origin. Note the desired font and font size must be set with fl_font() before calling this function. This differs slightly from fl_measure() in that the dx/dy values are also returned. No FLTK symbol expansion will be performed. Example use: \code int dx,dy,W,H; fl_font(FL_HELVETICA, 12); // set font face+size first fl_text_extents("Some text", dx, dy, W, H); // get width and height of string printf("text's width=%d, height=%d\n", W, H); \endcode */ FL_EXPORT void fl_text_extents(const char *, int &dx, int &dy, int &w, int &h); /** Determine the minimum pixel dimensions of a sequence of \p n characters (bytes) using the current fl_font(). \note The string length is measured in bytes, not (UTF-8) characters. \see fl_text_extents(const char*, int& dx, int& dy, int& w, int& h) */ inline void fl_text_extents(const char *t, int n, int &dx, int &dy, int &w, int &h) { fl_graphics_driver->text_extents(t, n, dx, dy, w, h); } // font encoding: // Note: doxygen comments here to avoid duplication for os-specific cases /** Convert text from Windows/X11 latin1 character set to local encoding. \param[in] t character string (latin1 encoding) \param[in] n optional number of characters (bytes) to convert (default is all) \returns pointer to internal buffer containing converted characters */ FL_EXPORT const char *fl_latin1_to_local(const char *t, int n = -1); /** Convert text from local encoding to Windows/X11 latin1 character set. \param[in] t character string (local encoding) \param[in] n optional number of characters (bytes) to convert (default is all) \returns pointer to internal buffer containing converted characters */ FL_EXPORT const char *fl_local_to_latin1(const char *t, int n = -1); /** Convert text from Mac Roman character set to local encoding. \param[in] t character string (Mac Roman encoding) \param[in] n optional number of characters to convert (default is all) \returns pointer to internal buffer containing converted characters */ FL_EXPORT const char *fl_mac_roman_to_local(const char *t, int n = -1); /** Convert text from local encoding to Mac Roman character set. \param[in] t character string (local encoding) \param[in] n optional number of characters to convert (default is all) \returns pointer to internal buffer containing converted characters */ FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n = -1); /** @} */ /** \addtogroup fl_drawings @{ */ FL_EXPORT float fl_override_scale(); FL_EXPORT void fl_restore_scale(float s); /** Draw a nul-terminated UTF-8 string starting at the given \p x, \p y location. Text is aligned to the left and to the baseline of the font. To align to the bottom, subtract fl_descent() from \p y. To align to the top, subtract fl_descent() and add fl_height(). This version of fl_draw provides direct access to the text drawing function of the underlying OS. It does not apply any special handling to control characters. */ FL_EXPORT void fl_draw(const char *str, int x, int y); /** Draw a nul-terminated UTF-8 string starting at the given \p x, \p y location and rotating \p angle degrees counter-clockwise. This version of fl_draw provides direct access to the text drawing function of the underlying OS and is supported by all fltk platforms except X11 without Xft. */ FL_EXPORT void fl_draw(int angle, const char *str, int x, int y); /** Draws starting at the given \p x, \p y location a UTF-8 string of length \p n bytes. */ inline void fl_draw(const char *str, int n, int x, int y) { fl_graphics_driver->draw(str, n, x, y); } /** Draw at the given \p x, \p y location a UTF-8 string of length \p n bytes rotating \p angle degrees counter-clockwise. \note When using X11 (Unix, Linux, Cygwin et al.) this needs Xft to work. Under plain X11 (w/o Xft) rotated text is not supported by FLTK. A warning will be issued to stderr at runtime (only once) if you use this method with an angle other than 0. */ inline void fl_draw(int angle, const char *str, int n, int x, int y) { fl_graphics_driver->draw(angle, str, n, x, y); } /** Draw a UTF-8 string of length \p n bytes right to left starting at the given \p x, \p y location. */ inline void fl_rtl_draw(const char *str, int n, int x, int y) { fl_graphics_driver->rtl_draw(str, n, x, y); } FL_EXPORT void fl_measure(const char *str, int &x, int &y, int draw_symbols = 1); /** Fancy string drawing function which is used to draw all the labels. The string is formatted and aligned inside the passed box. Handles '\\t' and '\\n', expands all other control characters to '^X', and aligns inside or against the edges of the box. See Fl_Widget::align() for values of \p align. The value FL_ALIGN_INSIDE is ignored, as this function always prints inside the box. If \p img is provided and is not \p NULL, the image is drawn above or below the text as specified by the \p align value. The \p draw_symbols argument specifies whether or not to look for symbol names starting with the '\@' character' \param[in] str UTF-8 string, can start and end with an '\@sym' symbol, can contain '\\n' \param[in] x,y,w,h bounding box \param[in] align label and image alignment in bounding box \param[in] img pointer to image \param[in] draw_symbols if true, interprete leading and trailing '\@sym' as graphical symbols \param[in] spacing spacing between text and image */ FL_EXPORT void fl_draw(const char *str, int x, int y, int w, int h, Fl_Align align, Fl_Image *img = 0, int draw_symbols = 1, int spacing = 0); /** The same as fl_draw(const char*,int,int,int,int,Fl_Align,Fl_Image*,int) with the addition of the \p callthis parameter, which is a pointer to a text drawing function such as fl_draw(const char*, int, int, int) to do the real work. \param[in] str UTF-8 string, can start and end with an '\@sym' symbol, can contain '\\n' \param[in] x,y,w,h bounding box \param[in] align label and image alignment in bounding box \param[in] callthis pointer to text drawing function \param[in] img pointer to image \param[in] draw_symbols if true, interprete leading and trailing '\@sym' as graphical symbols \param[in] spacing spacing between text and image */ FL_EXPORT void fl_draw(const char *str, int x, int y, int w, int h, Fl_Align align, void (*callthis)(const char *, int, int, int), Fl_Image *img = 0, int draw_symbols = 1, int spacing = 0); // boxtypes: FL_EXPORT void fl_frame(const char *s, int x, int y, int w, int h); FL_EXPORT void fl_frame2(const char *s, int x, int y, int w, int h); FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color); FL_EXPORT void fl_draw_box_focus(Fl_Boxtype, int x, int y, int w, int h, Fl_Color, Fl_Color); // basic GUI objects (check marks, arrows, more to come ...): // Draw a check mark in the given color inside the bounding box bb. void fl_draw_check(Fl_Rect bb, Fl_Color col); // Draw one or more "arrows" (triangles) FL_EXPORT void fl_draw_arrow(Fl_Rect bb, Fl_Arrow_Type t, Fl_Orientation o, Fl_Color color); // Draw a potentially small, filled circle FL_EXPORT void fl_draw_circle(int x, int y, int d, Fl_Color color); // Draw the full "radio button" of a radio menu entry or radio button // This requires scheme specific handling (particularly gtk+ scheme) FL_EXPORT void fl_draw_radio(int x, int y, int d, Fl_Color color); // images: /** Draw an 8-bit per color RGB or luminance image. \param[in] buf points at the "r" data of the top-left pixel. Color data must be in r,g,b order. Luminance data is only one gray byte. \param[in] X,Y position where to put top-left corner of image \param[in] W,H size of the image \param[in] D delta to add to the pointer between pixels. It may be any value greater than or equal to 1, or it can be negative to flip the image horizontally \param[in] L delta to add to the pointer between lines (if 0 is passed it uses \p W * \p D), and may be larger than \p W * \p D to crop data, or negative to flip the image vertically It is highly recommended that you put the following code before the first show() of \e any window in your program to get rid of the dithering if possible: \code Fl::visual(FL_RGB); \endcode Gray scale (1-channel) images may be drawn. This is done if abs(D) is less than 3, or by calling fl_draw_image_mono(). Only one 8-bit sample is used for each pixel, and on screens with different numbers of bits for red, green, and blue only gray colors are used. Setting \p D greater than 1 will let you display one channel of a color image. \par Note: The X version does not support all possible visuals. If FLTK cannot draw the image in the current visual it will abort. FLTK supports any visual of 8 bits or less, and all common TrueColor visuals up to 32 bits. */ inline void fl_draw_image(const uchar *buf, int X, int Y, int W, int H, int D = 3, int L = 0) { fl_graphics_driver->draw_image_general_(buf, X, Y, W, H, D, L); } /** Draw a gray-scale (1 channel) image. \see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L) */ inline void fl_draw_image_mono(const uchar *buf, int X, int Y, int W, int H, int D = 1, int L = 0) { fl_graphics_driver->draw_image_mono_general_(buf, X, Y, W, H, D, L); } /** Draw an image using a callback function to generate image data. You can generate the image as it is being drawn, or do arbitrary decompression of stored data, provided it can be decompressed to individual scan lines. \param[in] cb callback function to generate scan line data \param[in] data user data passed to callback function \param[in] X,Y screen position of top left pixel \param[in] W,H image width and height \param[in] D data size per pixel in bytes (must be greater than 0) \see fl_draw_image(const uchar* buf, int X, int Y, int W, int H, int D, int L) The callback function \p cb is called with the void* \p data user data pointer to allow access to a structure of information about the image, and the \p x, \p y, and \p w of the scan line desired from the image. 0,0 is the upper-left corner of the image, not \p x, \p y. A pointer to a buffer to put the data into is passed. You must copy \p w pixels from scanline \p y, starting at pixel \p x, to this buffer. Due to cropping, less than the whole image may be requested. So \p x may be greater than zero, the first \p y may be greater than zero, and \p w may be less than \p W. The buffer is long enough to store the entire \p W * \p D pixels, this is for convenience with some decompression schemes where you must decompress the entire line at once: decompress it into the buffer, and then if \p x is not zero, copy the data over so the \p x'th pixel is at the start of the buffer. You can assume the \p y's will be consecutive, except the first one may be greater than zero. If \p D is 4 or more, you must fill in the unused bytes with zero. */ inline void fl_draw_image(Fl_Draw_Image_Cb cb, void *data, int X, int Y, int W, int H, int D = 3) { fl_graphics_driver->draw_image(cb, data, X, Y, W, H, D); } /** Draw a gray-scale image using a callback function to generate image data. \see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D) */ inline void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void *data, int X, int Y, int W, int H, int D = 1) { fl_graphics_driver->draw_image_mono(cb, data, X, Y, W, H, D); } /** Check whether platform supports true alpha blending for RGBA images. \returns 1 if true alpha blending supported by platform \returns 0 not supported so FLTK will use screen door transparency */ inline char fl_can_do_alpha_blending() { return Fl_Graphics_Driver::default_driver().can_do_alpha_blending(); } FL_EXPORT uchar *fl_read_image(uchar *p, int X, int Y, int W, int H, int alpha = 0); FL_EXPORT Fl_RGB_Image *fl_capture_window(Fl_Window *win, int x, int y, int w, int h); // pixmaps: /** Draw XPM image data, with the top-left corner at the given position. The image is dithered on 8-bit displays so you won't lose color space for programs displaying both images and pixmaps. \param[in] data pointer to XPM image data \param[in] x,y position of top-left corner \param[in] bg background color \returns 0 if there was any error decoding the XPM data. */ FL_EXPORT int fl_draw_pixmap(const char *const *data, int x, int y, Fl_Color bg = FL_GRAY); /** Draw XPM image data, with the top-left corner at the given position. \see fl_draw_pixmap(const char* const* data, int x, int y, Fl_Color bg) */ inline int fl_draw_pixmap(/*const*/ char *const *data, int x, int y, Fl_Color bg = FL_GRAY) { return fl_draw_pixmap((const char *const *)data, x, y, bg); } FL_EXPORT int fl_measure_pixmap(/*const*/ char *const *data, int &w, int &h); FL_EXPORT int fl_measure_pixmap(const char *const *cdata, int &w, int &h); // other: FL_EXPORT void fl_scroll(int X, int Y, int W, int H, int dx, int dy, void (*draw_area)(void *, int, int, int, int), void *data); FL_EXPORT const char *fl_shortcut_label(unsigned int shortcut); FL_EXPORT const char *fl_shortcut_label(unsigned int shortcut, const char **eom); FL_EXPORT unsigned int fl_old_shortcut(const char *s); FL_EXPORT void fl_overlay_rect(int x, int y, int w, int h); FL_EXPORT void fl_overlay_clear(); FL_EXPORT void fl_cursor(Fl_Cursor); FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color fg, Fl_Color bg = FL_WHITE); FL_EXPORT const char *fl_expand_text(const char *from, char *buf, int maxbuf, double maxw, int &n, double &width, int wrap, int draw_symbols = 0); // XIM: FL_EXPORT void fl_set_status(int X, int Y, int W, int H); /** Inform text input methods about the current text insertion cursor. \param font Font currently in use in text input. \param size Size of the current font. \param X,Y Position of the bottom of the current text insertion cursor. \param W,H Width and height of the current text insertion cursor. \param win Points to the Fl_Window object containing the current text widget, or NULL. */ FL_EXPORT void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win = 0); /** Resets marked text. In many languages, typing a character can involve multiple keystrokes. For example, the Ä can be composed of two dots (¨) on top of the character, followed by the letter A (on a Mac with U.S. keyboard, you'd type Alt-U, Shift-A. To inform the user that the dots may be followed by another character, the ¨ is underlined). Call this function if character composition needs to be aborted for some reason. One such example would be the text input widget losing focus. */ FL_EXPORT void fl_reset_spot(void); // XForms symbols: FL_EXPORT int fl_draw_symbol(const char *label, int x, int y, int w, int h, Fl_Color); FL_EXPORT int fl_add_symbol(const char *name, void (*drawit)(Fl_Color), int scalable); /** @} */ #endif ================================================ FILE: Game Trainers/common/include/FL/fl_message.H ================================================ // // Standard message header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef _FL_fl_message_H_ #define _FL_fl_message_H_ #include "fl_ask.H" #endif ================================================ FILE: Game Trainers/common/include/FL/fl_show_colormap.H ================================================ // // Colormap picker header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file The fl_show_colormap() function hides the implementation classes used to provide the popup window and color selection mechanism. */ #ifndef fl_show_colormap_H #define fl_show_colormap_H /* doxygen comment here to avoid exposing ColorMenu in fl_show_colormap.cxx */ /** \addtogroup fl_attributes @{ */ /** \brief Pops up a window to let the user pick a colormap entry. \image html fl_show_colormap.png \image latex fl_show_colormap.png "fl_show_colormap" height=10cm \param[in] oldcol color to be highlighted when grid is shown. \retval Fl_Color value of the chosen colormap entry. \see Fl_Color_Chooser */ FL_EXPORT Fl_Color fl_show_colormap(Fl_Color oldcol); /** @} */ #endif ================================================ FILE: Game Trainers/common/include/FL/fl_show_input.H ================================================ // // Standard input dialog header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #include "fl_ask.H" ================================================ FILE: Game Trainers/common/include/FL/fl_string_functions.h ================================================ /* * Platform agnostic string portability functions for the Fast Light Tool Kit (FLTK). * * Copyright 2020-2022 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /** \file fl_string_functions.h Public header for FLTK's platform-agnostic string handling. */ #ifndef _FL_fl_string_functions_h_ #define _FL_fl_string_functions_h_ #include "Fl_Export.H" #ifdef __cplusplus extern "C" { #endif #include // size_t /** \defgroup fl_string String handling functions String handling functions declared in @{ */ FL_EXPORT char* fl_strdup(const char *s); FL_EXPORT size_t fl_strlcpy(char *, const char *, size_t); /** @} */ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _FL_fl_string_functions_h_ */ ================================================ FILE: Game Trainers/common/include/FL/fl_types.h ================================================ /* * Simple "C"-style types for the Fast Light Tool Kit (FLTK). * * Copyright 1998-2020 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /** \file * This file contains simple "C"-style type definitions. */ #ifndef FL_TYPES_H #define FL_TYPES_H #include "fl_attr.h" /** \name Miscellaneous */ /**@{*/ /* group: Miscellaneous */ /** unsigned char */ typedef unsigned char uchar; /** unsigned long */ typedef unsigned long ulong; /** 16-bit Unicode character + 8-bit indicator for keyboard flags. \note This \b should be 24-bit Unicode character + 8-bit indicator for keyboard flags. The upper 8 bits are currently unused but reserved. Due to compatibility issues this type and all FLTK \b shortcuts can only be used with 16-bit Unicode characters (U+0000 .. U+FFFF) and not with the full range of unicode characters (U+0000 .. U+10FFFF). This is caused by the bit flags \c FL_SHIFT, \c FL_CTRL, \c FL_ALT, and \c FL_META being all in the range 0x010000 .. 0x400000. \todo Discuss and decide whether we can "shift" these special keyboard flags to the upper byte to enable full 21-bit Unicode characters (U+0000 .. U+10FFFF) plus the keyboard indicator bits as this was originally intended. This would be possible if we could rely on \b all programs being coded with symbolic names and not hard coded bit values. \internal Can we do the move for 1.4 or, if not, for any later version that is allowed to break the ABI? */ typedef unsigned int Fl_Shortcut; /**@}*/ /* group: Miscellaneous */ #endif ================================================ FILE: Game Trainers/common/include/FL/fl_utf8.h ================================================ /* * Author: Jean-Marc Lienher ( http://oksid.ch ) * Copyright 2000-2010 by O'ksi'D. * Copyright 2016-2021 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ /* Merged in some functionality from the fltk-2 version. IMM. * The following code is an attempt to merge the functions incorporated in FLTK2 * with the functions provided in OksiD's fltk-1.1.6-utf8 port */ /** \file fl_utf8.h \brief header for Unicode and UTF-8 character handling */ #ifndef _HAVE_FL_UTF8_HDR_ #define _HAVE_FL_UTF8_HDR_ #include "Fl_Export.H" #include "fl_types.h" #include // FILE *fl_fopen() #include // struct stat #ifdef __cplusplus extern "C" { #endif /** \addtogroup fl_unicode @{ */ /* F2: comes from FLTK2 */ /* OD: comes from OksiD */ /** Return the number of bytes needed to encode the given UCS4 character in UTF-8. \param [in] ucs UCS4 encoded character \return number of bytes required */ FL_EXPORT int fl_utf8bytes(unsigned ucs); /* OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid) */ FL_EXPORT int fl_utf8len(char c); /* OD: returns the byte length of the first UTF-8 char sequence (returns +1 if not valid) */ FL_EXPORT int fl_utf8len1(char c); /* OD: returns the byte length of a UTF-8 text */ FL_EXPORT int fl_utf8strlen(const char *text, int len); /* OD: returns the number of Unicode chars in the UTF-8 string */ FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len); /* F2: Convert the next UTF-8 char-sequence into a Unicode value (and say how many bytes were used) */ FL_EXPORT unsigned fl_utf8decode(const char* p, const char* end, int* len); /* F2: Encode a Unicode value into a UTF-8 sequence, return the number of bytes used */ FL_EXPORT int fl_utf8encode(unsigned ucs, char* buf); /* F2: Move forward to the next valid UTF-8 sequence start betwen start and end */ FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* end); /* F2: Move backward to the previous valid UTF-8 sequence start */ FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end); /* XX: Convert a single 32-bit Unicode value into UTF16 */ FL_EXPORT unsigned fl_ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen); /* F2: Convert a UTF-8 string into UTF16 */ FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen); /* F2: Convert a UTF-8 string into a wide character string - makes UTF16 on win32, "UCS4" elsewhere */ FL_EXPORT unsigned fl_utf8towc(const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen); /* F2: Convert a wide character string to UTF-8 - takes in UTF16 on win32, "UCS4" elsewhere */ FL_EXPORT unsigned fl_utf8fromwc(char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen); /* F2: Convert a UTF-8 string into ASCII, eliding untranslatable glyphs */ FL_EXPORT unsigned fl_utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen); /* F2: Convert 8859-1 string to UTF-8 */ FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen); /* F2: Returns true if the current O/S locale is UTF-8 */ FL_EXPORT int fl_utf8locale(void); /* F2: Examine the first len characters of src, to determine if the input text is UTF-8 or not * NOTE: The value returned is not simply boolean - it contains information about the probable * type of the src text. */ FL_EXPORT int fl_utf8test(const char *src, unsigned len); /* XX: return width of "raw" ucs character in columns. * for internal use only */ FL_EXPORT int fl_wcwidth_(unsigned int ucs); /* XX: return width of UTF-8 character string in columns. * NOTE: this may also do C1 control character (0x80 to 0x9f) to CP1252 mapping, * depending on original build options */ FL_EXPORT int fl_wcwidth(const char *src); /* OD: Return true if the character is non-spacing */ FL_EXPORT unsigned int fl_nonspacing(unsigned int ucs); /* F2: Convert UTF-8 to a local multi-byte encoding - mainly for win32? */ FL_EXPORT unsigned fl_utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen); /* OD: Convert UTF-8 to a local multi-byte encoding */ FL_EXPORT char* fl_utf2mbcs(const char *src); /* F2: Convert a local multi-byte encoding to UTF-8 - mainly for win32? */ FL_EXPORT unsigned fl_utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen); /*****************************************************************************/ #ifdef _WIN32 /* these two Windows-only functions are kept for API compatibility */ /* OD: Attempt to convert the UTF-8 string to the current locale */ FL_EXPORT char *fl_utf8_to_locale(const char *s, int len, unsigned int codepage); /* OD: Attempt to convert a string in the current locale to UTF-8 */ FL_EXPORT char *fl_locale_to_utf8(const char *s, int len, unsigned int codepage); #endif /* _WIN32 */ /***************************************************************************** * The following functions are intended to provide portable, UTF-8 aware * versions of standard functions */ /* OD: UTF-8 aware strncasecmp - converts to lower case Unicode and tests */ FL_EXPORT int fl_utf_strncasecmp(const char *s1, const char *s2, int n); /* OD: UTF-8 aware strcasecmp - converts to Unicode and tests */ FL_EXPORT int fl_utf_strcasecmp(const char *s1, const char *s2); /* OD: return the Unicode lower case value of ucs */ FL_EXPORT int fl_tolower(unsigned int ucs); /* OD: return the Unicode upper case value of ucs */ FL_EXPORT int fl_toupper(unsigned int ucs); /* OD: converts the UTF-8 string to the lower case equivalent */ FL_EXPORT int fl_utf_tolower(const unsigned char *str, int len, char *buf); /* OD: converts the UTF-8 string to the upper case equivalent */ FL_EXPORT int fl_utf_toupper(const unsigned char *str, int len, char *buf); /* OD: Portable UTF-8 aware chmod wrapper */ FL_EXPORT int fl_chmod(const char* f, int mode); /* OD: Portable UTF-8 aware access wrapper */ FL_EXPORT int fl_access(const char* f, int mode); /* OD: Portable UTF-8 aware stat wrapper */ FL_EXPORT int fl_stat(const char *path, struct stat *buffer); /* OD: Portable UTF-8 aware getcwd wrapper */ FL_EXPORT char *fl_getcwd(char *buf, int len); /* Portable UTF-8 aware chdir wrapper */ FL_EXPORT int fl_chdir(const char *path); /* OD: Portable UTF-8 aware fopen wrapper */ FL_EXPORT FILE *fl_fopen(const char *f, const char *mode); /* OD: Portable UTF-8 aware system wrapper */ FL_EXPORT int fl_system(const char* f); /* OD: Portable UTF-8 aware execvp wrapper */ FL_EXPORT int fl_execvp(const char *file, char *const *argv); /* OD: Portable UTF-8 aware open wrapper */ FL_EXPORT int fl_open(const char *fname, int oflags, ...); FL_EXPORT int fl_open_ext(const char *fname, int binary, int oflags, ...); /* Portable wrapper around unix-style close() function */ FL_EXPORT int fl_close_fd(int fd); /* OD: Portable UTF-8 aware unlink wrapper */ FL_EXPORT int fl_unlink(const char *fname); /* OD: Portable UTF-8 aware rmdir wrapper */ FL_EXPORT int fl_rmdir(const char *f); /* OD: Portable UTF-8 aware getenv wrapper */ FL_EXPORT char* fl_getenv(const char *name); /* Portable UTF-8 aware putenv wrapper */ FL_EXPORT int fl_putenv(const char *var); /* OD: Portable UTF-8 aware mkdir wrapper */ FL_EXPORT int fl_mkdir(const char* f, int mode); /* OD: Portable UTF-8 aware rename wrapper */ FL_EXPORT int fl_rename(const char* f, const char *t); /* OD: Given a full pathname, this will create the directory path needed to hold the file named */ FL_EXPORT void fl_make_path_for_file( const char *path ); /* OD: recursively create a path in the file system */ FL_EXPORT char fl_make_path( const char *path ); /** @} */ /*****************************************************************************/ #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* _HAVE_FL_UTF8_HDR_ */ ================================================ FILE: Game Trainers/common/include/FL/forms.H ================================================ // // Forms emulation header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef __FORMS_H__ #define __FORMS_H__ #include "Fl.H" #include "Fl_Group.H" #include "Fl_Window.H" #include "fl_draw.H" typedef Fl_Widget FL_OBJECT; typedef Fl_Window FL_FORM; //////////////////////////////////////////////////////////////// // Random constants & symbols defined by forms.h file: #ifndef NULL #define NULL 0 #endif #ifndef FALSE #define FALSE 0 #define TRUE 1 #endif #define FL_ON 1 #define FL_OK 1 #define FL_VALID 1 #define FL_PREEMPT 1 #define FL_AUTO 2 #define FL_WHEN_NEEDED FL_AUTO #define FL_OFF 0 #define FL_NONE 0 #define FL_CANCEL 0 #define FL_INVALID 0 #define FL_IGNORE -1 // #define FL_CLOSE -2 // this variable is never used in FLTK Forms. It is removed // because it conflicts with the window FL_CLOSE event #define FL_LCOL FL_BLACK #define FL_COL1 FL_GRAY #define FL_MCOL FL_LIGHT1 #define FL_LEFT_BCOL FL_LIGHT3 // 53 is better match #define FL_TOP_BCOL FL_LIGHT2 // 51 #define FL_BOTTOM_BCOL FL_DARK2 // 40 #define FL_RIGHT_BCOL FL_DARK3 // 36 #define FL_INACTIVE FL_INACTIVE_COLOR #define FL_INACTIVE_COL FL_INACTIVE_COLOR #define FL_FREE_COL1 FL_FREE_COLOR #define FL_FREE_COL2 ((Fl_Color)(FL_FREE_COLOR+1)) #define FL_FREE_COL3 ((Fl_Color)(FL_FREE_COLOR+2)) #define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3)) #define FL_FREE_COL5 ((Fl_Color)(FL_FREE_COLOR+4)) #define FL_FREE_COL6 ((Fl_Color)(FL_FREE_COLOR+5)) #define FL_FREE_COL7 ((Fl_Color)(FL_FREE_COLOR+6)) #define FL_FREE_COL8 ((Fl_Color)(FL_FREE_COLOR+7)) #define FL_FREE_COL9 ((Fl_Color)(FL_FREE_COLOR+8)) #define FL_FREE_COL10 ((Fl_Color)(FL_FREE_COLOR+9)) #define FL_FREE_COL11 ((Fl_Color)(FL_FREE_COLOR+10)) #define FL_FREE_COL12 ((Fl_Color)(FL_FREE_COLOR+11)) #define FL_FREE_COL13 ((Fl_Color)(FL_FREE_COLOR+12)) #define FL_FREE_COL14 ((Fl_Color)(FL_FREE_COLOR+13)) #define FL_FREE_COL15 ((Fl_Color)(FL_FREE_COLOR+14)) #define FL_FREE_COL16 ((Fl_Color)(FL_FREE_COLOR+15)) #define FL_TOMATO ((Fl_Color)(131)) #define FL_INDIANRED ((Fl_Color)(164)) #define FL_SLATEBLUE ((Fl_Color)(195)) #define FL_DARKGOLD ((Fl_Color)(84)) #define FL_PALEGREEN ((Fl_Color)(157)) #define FL_ORCHID ((Fl_Color)(203)) #define FL_DARKCYAN ((Fl_Color)(189)) #define FL_DARKTOMATO ((Fl_Color)(113)) #define FL_WHEAT ((Fl_Color)(174)) #define FL_ALIGN_BESIDE FL_ALIGN_INSIDE #define FL_PUP_TOGGLE 2 // FL_MENU_TOGGLE #define FL_PUP_INACTIVE 1 // FL_MENU_INACTIVE #define FL_NO_FRAME FL_NO_BOX #define FL_ROUNDED3D_UPBOX FL_ROUND_UP_BOX #define FL_ROUNDED3D_DOWNBOX FL_ROUND_DOWN_BOX #define FL_OVAL3D_UPBOX FL_ROUND_UP_BOX #define FL_OVAL3D_DOWNBOX FL_ROUND_DOWN_BOX #define FL_MBUTTON1 1 #define FL_LEFTMOUSE 1 #define FL_MBUTTON2 2 #define FL_MIDDLEMOUSE 2 #define FL_MBUTTON3 3 #define FL_RIGHTMOUSE 3 #define FL_MBUTTON4 4 #define FL_MBUTTON5 5 #define FL_INVALID_STYLE 255 #define FL_NORMAL_STYLE FL_HELVETICA #define FL_BOLD_STYLE FL_HELVETICA_BOLD #define FL_ITALIC_STYLE FL_HELVETICA_ITALIC #define FL_BOLDITALIC_STYLE FL_HELVETICA_BOLD_ITALIC #define FL_FIXED_STYLE FL_COURIER #define FL_FIXEDBOLD_STYLE FL_COURIER_BOLD #define FL_FIXEDITALIC_STYLE FL_COURIER_ITALIC #define FL_FIXEDBOLDITALIC_STYLE FL_COURIER_BOLD_ITALIC #define FL_TIMES_STYLE FL_TIMES #define FL_TIMESBOLD_STYLE FL_TIMES_BOLD #define FL_TIMESITALIC_STYLE FL_TIMES_ITALIC #define FL_TIMESBOLDITALIC_STYLE FL_TIMES_BOLD_ITALIC // hacks to change the labeltype() when passed to fl_set_object_lstyle(): #define FL_SHADOW_STYLE (FL_SHADOW_LABEL<<8) #define FL_ENGRAVED_STYLE (FL_ENGRAVED_LABEL<<8) #define FL_EMBOSSED_STYLE (FL_EMBOSSED_LABEL<<0) // size values are different from XForms, match older Forms: #define FL_TINY_SIZE 8 #define FL_SMALL_SIZE 11 // 10 //#define FL_NORMAL_SIZE 14 // 12 #define FL_MEDIUM_SIZE 18 // 14 #define FL_LARGE_SIZE 24 // 18 #define FL_HUGE_SIZE 32 // 24 #define FL_DEFAULT_SIZE FL_SMALL_SIZE #define FL_TINY_FONT FL_TINY_SIZE #define FL_SMALL_FONT FL_SMALL_SIZE #define FL_NORMAL_FONT FL_NORMAL_SIZE #define FL_MEDIUM_FONT FL_MEDIUM_SIZE #define FL_LARGE_FONT FL_LARGE_SIZE #define FL_HUGE_FONT FL_HUGE_SIZE #define FL_NORMAL_FONT1 FL_SMALL_FONT #define FL_NORMAL_FONT2 FL_NORMAL_FONT #define FL_DEFAULT_FONT FL_SMALL_FONT #define FL_RETURN_END_CHANGED FL_WHEN_RELEASE #define FL_RETURN_CHANGED FL_WHEN_CHANGED #define FL_RETURN_END FL_WHEN_RELEASE_ALWAYS #define FL_RETURN_ALWAYS (FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED) #define FL_BOUND_WIDTH 3 typedef int FL_Coord; typedef int FL_COLOR; //////////////////////////////////////////////////////////////// // fltk interaction: #define FL_CMD_OPT void extern FL_EXPORT void fl_initialize(int*, char*[], const char*, FL_CMD_OPT*, int); inline void fl_finish() {} typedef void (*FL_IO_CALLBACK) (FL_SOCKET, void*); inline void fl_add_io_callback(int fd, short w, FL_IO_CALLBACK cb, void* v) { Fl::add_fd(fd, w, cb, v);} inline void fl_remove_io_callback(int fd, short, FL_IO_CALLBACK) { Fl::remove_fd(fd);} // removes all the callbacks! // type of callback is different and no "id" number is returned: inline void fl_add_timeout(long msec, void (*cb)(void*), void* v) { Fl::add_timeout(msec*.001, cb, v);} inline void fl_remove_timeout(int) {} // type of callback is different! inline void fl_set_idle_callback(void (*cb)()) {Fl::set_idle(cb);} FL_EXPORT Fl_Widget* fl_do_forms(void); FL_EXPORT Fl_Widget* fl_check_forms(); inline Fl_Widget* fl_do_only_forms(void) {return fl_do_forms();} inline Fl_Widget* fl_check_only_forms(void) {return fl_check_forms();} // because of new redraw behavior, these are no-ops: inline void fl_freeze_object(Fl_Widget*) {} inline void fl_unfreeze_object(Fl_Widget*) {} inline void fl_freeze_form(Fl_Window*) {} inline void fl_unfreeze_form(Fl_Window*) {} inline void fl_freeze_all_forms() {} inline void fl_unfreeze_all_forms() {} inline void fl_set_focus_object(Fl_Window*, Fl_Widget* o) {Fl::focus(o);} inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);} #define fl_set_object_focus fl_set_focus_object // void fl_set_form_atclose(Fl_Window*w,int (*cb)(Fl_Window*,void*),void* v) // void fl_set_atclose(int (*cb)(Fl_Window*,void*),void*) // fl_set_form_atactivate/atdeactivate not implemented! //////////////////////////////////////////////////////////////// // Fl_Widget: inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);} inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->labelsize(s);} /* forms lib font indexes must be byte sized - extract correct byte from style word */ inline void fl_set_object_lstyle(Fl_Widget* o,int a) { o->labelfont((Fl_Font)(a&0xff)); o->labeltype((Fl_Labeltype)(a>>8));} inline void fl_set_object_lcol(Fl_Widget* o, Fl_Color a) {o->labelcolor(a);} #define fl_set_object_lcolor fl_set_object_lcol inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);} #define fl_set_object_align fl_set_object_lalign inline void fl_set_object_color(Fl_Widget* o,Fl_Color a,Fl_Color b) {o->color(a,b);} inline void fl_set_object_label(Fl_Widget* o, const char* a) {o->label(a); o->redraw();} inline void fl_set_object_position(Fl_Widget*o,int x,int y) {o->position(x,y);} inline void fl_set_object_size(Fl_Widget* o, int w, int h) {o->size(w,h);} inline void fl_set_object_geometry(Fl_Widget* o,int x,int y,int w,int h) {o->resize(x,y,w,h);} inline void fl_get_object_geometry(Fl_Widget* o,int*x,int*y,int*w,int*h) { *x = o->x(); *y = o->y(); *w = o->w(); *h = o->h();} inline void fl_get_object_position(Fl_Widget* o,int*x,int*y) { *x = o->x(); *y = o->y();} typedef void (*Forms_CB)(Fl_Widget*, long); inline void fl_set_object_callback(Fl_Widget*o,Forms_CB c,long a) {o->callback(c,a);} #define fl_set_call_back fl_set_object_callback inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();} inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();} inline void fl_set_object_return(Fl_Widget* o, int v) { o->when((Fl_When)(v|FL_WHEN_RELEASE));} inline void fl_redraw_object(Fl_Widget* o) {o->redraw();} inline void fl_show_object(Fl_Widget* o) {o->show();} inline void fl_hide_object(Fl_Widget* o) {o->hide();} inline void fl_free_object(Fl_Widget* x) {delete x;} inline void fl_delete_object(Fl_Widget* o) {o->parent()->remove(*o);} inline void fl_activate_object(Fl_Widget* o) {o->activate();} inline void fl_deactivate_object(Fl_Widget* o) {o->deactivate();} inline void fl_add_object(Fl_Window* f, Fl_Widget* x) {f->add(x);} inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) {b->parent()->insert(*o,b);} inline Fl_Window* FL_ObjWin(Fl_Widget* o) {return o->window();} //////////////////////////////////////////////////////////////// // things that appered in the demos a lot that I don't emulate, but // I did not want to edit out of all the demos... inline int fl_get_border_width() {return 3;} inline void fl_set_border_width(int) {} inline void fl_set_object_dblbuffer(Fl_Widget*, int) {} inline void fl_set_form_dblbuffer(Fl_Window*, int) {} //////////////////////////////////////////////////////////////// // Fl_Window: inline void fl_free_form(Fl_Window* x) {delete x;} inline void fl_redraw_form(Fl_Window* f) {f->redraw();} inline Fl_Window* fl_bgn_form(Fl_Boxtype b,int w,int h) { Fl_Window* g = new Fl_Window(w,h,0); g->box(b); return g; } FL_EXPORT void fl_end_form(); inline void fl_addto_form(Fl_Window* f) {f->begin();} inline Fl_Group* fl_bgn_group() {return new Fl_Group(0,0,0,0,0);} inline void fl_end_group() {Fl_Group::current()->forms_end();} inline void fl_addto_group(Fl_Widget* o) {((Fl_Group* )o)->begin();} #define resizebox _ddfdesign_kludge() inline void fl_scale_form(Fl_Window* f, double x, double y) { f->resizable(f); f->size(int(f->w()*x),int(f->h()*y));} inline void fl_set_form_position(Fl_Window* f,int x,int y) {f->position(x,y);} inline void fl_set_form_size(Fl_Window* f, int w, int h) {f->size(w,h);} inline void fl_set_form_geometry(Fl_Window* f,int x,int y,int w,int h) { f->resize(x,y,w,h);} #define fl_set_initial_placement fl_set_form_geometry inline void fl_adjust_form_size(Fl_Window*) {} FL_EXPORT void fl_show_form(Fl_Window* f,int p,int b,const char* n); enum { // "p" argument values: FL_PLACE_FREE = 0, // make resizable FL_PLACE_MOUSE = 1, // mouse centered on form FL_PLACE_CENTER = 2, // center of the screen FL_PLACE_POSITION = 4,// fixed position, resizable FL_PLACE_SIZE = 8, // fixed size, normal fltk behavior FL_PLACE_GEOMETRY =16,// fixed size and position FL_PLACE_ASPECT = 32, // keep aspect ratio (ignored) FL_PLACE_FULLSCREEN=64,// fill screen FL_PLACE_HOTSPOT = 128,// enables hotspot FL_PLACE_ICONIC = 256,// iconic (ignored) FL_FREE_SIZE=(1<<14), // force resizable FL_FIX_SIZE =(1<<15) // force off resizable }; #define FL_PLACE_FREE_CENTER (FL_PLACE_CENTER|FL_FREE_SIZE) #define FL_PLACE_CENTERFREE (FL_PLACE_CENTER|FL_FREE_SIZE) enum { // "b" arguement values: FL_NOBORDER = 0, FL_FULLBORDER, FL_TRANSIENT //FL_MODAL = (1<<8) // not implemented yet in Forms }; inline void fl_set_form_hotspot(Fl_Window* w,int x,int y) {w->hotspot(x,y);} inline void fl_set_form_hotobject(Fl_Window* w, Fl_Widget* o) {w->hotspot(o);} extern FL_EXPORT char fl_flip; // in forms.C inline void fl_flip_yorigin() {fl_flip = 1;} #define fl_prepare_form_window fl_show_form inline void fl_show_form_window(Fl_Window*) {} inline void fl_raise_form(Fl_Window* f) {f->show();} inline void fl_hide_form(Fl_Window* f) {f->hide();} inline void fl_pop_form(Fl_Window* f) {f->show();} extern FL_EXPORT char fl_modal_next; // in forms.C inline void fl_activate_all_forms() {} inline void fl_deactivate_all_forms() {fl_modal_next = 1;} inline void fl_deactivate_form(Fl_Window*w) {w->deactivate();} inline void fl_activate_form(Fl_Window*w) {w->activate();} inline void fl_set_form_title(Fl_Window* f, const char* s) {f->label(s);} inline void fl_title_form(Fl_Window* f, const char* s) {f->label(s);} typedef void (*Forms_FormCB)(Fl_Widget*); inline void fl_set_form_callback(Fl_Window* f,Forms_FormCB c) {f->callback(c);} #define fl_set_form_call_back fl_set_form_callback inline void fl_init() {} FL_EXPORT void fl_set_graphics_mode(int,int); inline int fl_form_is_visible(Fl_Window* f) {return f->visible();} inline int fl_mouse_button() {return Fl::event_button();} #define fl_mousebutton fl_mouse_button #define fl_free free #define fl_malloc malloc #define fl_calloc calloc #define fl_realloc realloc //////////////////////////////////////////////////////////////// // Drawing functions. Only usable inside an Fl_Free object? inline void fl_drw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { fl_draw_box(b,x,y,w,h,bgc);} inline void fl_drw_frame(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { fl_draw_box(b,x,y,w,h,bgc);} inline void fl_drw_text(Fl_Align align, int x, int y, int w, int h, Fl_Color fgcolor, int size, Fl_Font style, const char* s) { fl_font(style,size); fl_color(fgcolor); fl_draw(s,x,y,w,h,align); } // this does not work except for CENTER... inline void fl_drw_text_beside(Fl_Align align, int x, int y, int w, int h, Fl_Color fgcolor, int size, Fl_Font style, const char* s) { fl_font(style,size); fl_color(fgcolor); fl_draw(s,x,y,w,h,align); } inline void fl_set_font_name(Fl_Font n,const char* s) {Fl::set_font(n,s);} inline void fl_mapcolor(Fl_Color c, uchar r, uchar g, uchar b) {Fl::set_color(c,r,g,b);} #define fl_set_clipping(x,y,w,h) fl_push_clip(x,y,w,h) #define fl_unset_clipping() fl_pop_clip() //////////////////////////////////////////////////////////////// // Forms classes: inline Fl_Widget* fl_add_new(Fl_Widget* p) {return p;} inline Fl_Widget* fl_add_new(uchar t,Fl_Widget* p) {p->type(t); return p;} #define forms_constructor(type,name) \ inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ return (type*)(fl_add_new(t, new type(x,y,w,h,l)));} #define forms_constructort(type,name) \ inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} #define forms_constructorb(type,name) \ inline type* name(Fl_Boxtype t,int x,int y,int w,int h,const char* l) { \ return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} #include "Fl_FormsBitmap.H" #define FL_NORMAL_BITMAP FL_NO_BOX forms_constructorb(Fl_FormsBitmap, fl_add_bitmap) inline void fl_set_bitmap_data(Fl_Widget* o, int w, int h, const uchar* b) { ((Fl_FormsBitmap*)o)->set(w,h,b); } #include "Fl_FormsPixmap.H" #define FL_NORMAL_PIXMAP FL_NO_BOX forms_constructorb(Fl_FormsPixmap, fl_add_pixmap) inline void fl_set_pixmap_data(Fl_Widget* o, char*const* b) { ((Fl_FormsPixmap*)o)->set(b); } //inline void fl_set_pixmap_file(Fl_Widget*, const char*); inline void fl_set_pixmap_align(Fl_Widget* o,Fl_Align a,int,int) {o->align(a);} //inline void fl_set_pixmap_colorcloseness(int, int, int); #include "Fl_Box.H" forms_constructorb(Fl_Box, fl_add_box) #include "Fl_Browser.H" forms_constructor(Fl_Browser, fl_add_browser) inline void fl_clear_browser(Fl_Widget* o) { ((Fl_Browser*)o)->clear();} inline void fl_add_browser_line(Fl_Widget* o, const char* s) { ((Fl_Browser*)o)->add(s);} inline void fl_addto_browser(Fl_Widget* o, const char* s) { ((Fl_Browser*)o)->add(s);} /* should also scroll to bottom */ //inline void fl_addto_browser_chars(Fl_Widget*, const char*) //#define fl_append_browser fl_addto_browser_chars inline void fl_insert_browser_line(Fl_Widget* o, int n, const char* s) { ((Fl_Browser*)o)->insert(n,s);} inline void fl_delete_browser_line(Fl_Widget* o, int n) { ((Fl_Browser*)o)->remove(n);} inline void fl_replace_browser_line(Fl_Widget* o, int n, const char* s) { ((Fl_Browser*)o)->replace(n,s);} inline char* fl_get_browser_line(Fl_Widget* o, int n) { return (char*)(((Fl_Browser*)o)->text(n));} inline int fl_load_browser(Fl_Widget* o, const char* f) { return ((Fl_Browser*)o)->load(f);} inline void fl_select_browser_line(Fl_Widget* o, int n) { ((Fl_Browser*)o)->select(n,1);} inline void fl_deselect_browser_line(Fl_Widget* o, int n) { ((Fl_Browser*)o)->select(n,0);} inline void fl_deselect_browser(Fl_Widget* o) { ((Fl_Browser*)o)->deselect();} inline int fl_isselected_browser_line(Fl_Widget* o, int n) { return ((Fl_Browser*)o)->selected(n);} inline int fl_get_browser_topline(Fl_Widget* o) { return ((Fl_Browser*)o)->topline();} inline int fl_get_browser(Fl_Widget* o) { return ((Fl_Browser*)o)->value();} inline int fl_get_browser_maxline(Fl_Widget* o) { return ((Fl_Browser*)o)->size();} //linline int fl_get_browser_screenlines(Fl_Widget*); inline void fl_set_browser_topline(Fl_Widget* o, int n) { ((Fl_Browser*)o)->topline(n);} inline void fl_set_browser_fontsize(Fl_Widget* o, int s) { ((Fl_Browser*)o)->textsize(s);} inline void fl_set_browser_fontstyle(Fl_Widget* o, Fl_Font s) { ((Fl_Browser*)o)->textfont(s);} inline void fl_set_browser_specialkey(Fl_Widget* o, char c) { ((Fl_Browser*)o)->format_char(c);} //inline void fl_set_browser_vscrollbar(Fl_Widget*, int); //inline void fl_set_browser_hscrollbar(Fl_Widget*, int); //inline void fl_set_browser_leftslider(Fl_Widget*, int); //#define fl_set_browser_leftscrollbar fl_set_browser_leftslider //inline void fl_set_browser_line_selectable(Fl_Widget*, int, int); //inline void fl_get_browser_dimension(Fl_Widget*,int*,int*,int*,int*); //inline void fl_set_browser_dblclick_callback(Fl_Widget*,FL_CALLBACKPTR,long); //inline void fl_set_browser_xoffset(Fl_Widget*, FL_Coord); //inline void fl_set_browser_scrollbarsize(Fl_Widget*, int, int); inline void fl_setdisplayed_browser_line(Fl_Widget* o, int n, int i) { ((Fl_Browser*)o)->display(n,i);} inline int fl_isdisplayed_browser_line(Fl_Widget* o, int n) { return ((Fl_Browser*)o)->displayed(n);} #include "Fl_Button.H" #define FL_NORMAL_BUTTON 0 #define FL_TOUCH_BUTTON 4 #define FL_INOUT_BUTTON 5 #define FL_RETURN_BUTTON 6 #define FL_HIDDEN_RET_BUTTON 7 #define FL_PUSH_BUTTON FL_TOGGLE_BUTTON #define FL_MENU_BUTTON 9 FL_EXPORT Fl_Button* fl_add_button(uchar t,int x,int y,int w,int h,const char* l); inline int fl_get_button(Fl_Widget* b) {return ((Fl_Button*)b)->value();} inline void fl_set_button(Fl_Widget* b, int v) {((Fl_Button*)b)->value(v);} inline int fl_get_button_numb(Fl_Widget*) {return Fl::event_button();} inline void fl_set_button_shortcut(Fl_Widget* b, const char* s,int=0) { ((Fl_Button*)b)->shortcut(s);} //#define fl_set_object_shortcut(b,s) fl_set_button_shortcut(b,s) #include "Fl_Light_Button.H" forms_constructor(Fl_Light_Button, fl_add_lightbutton) #include "Fl_Round_Button.H" forms_constructor(Fl_Round_Button, fl_add_roundbutton) forms_constructor(Fl_Round_Button, fl_add_round3dbutton) #include "Fl_Check_Button.H" forms_constructor(Fl_Check_Button, fl_add_checkbutton) inline Fl_Widget* fl_add_bitmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} inline void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) { (new Fl_Bitmap(c,a,b))->label(o);} // does not delete old Fl_Bitmap! inline Fl_Widget* fl_add_pixmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} inline void fl_set_pixmapbutton_data(Fl_Widget* o, const char*const* c) { (new Fl_Pixmap(c))->label(o);} // does not delete old Fl_Pixmap! // Fl_Canvas object not yet implemented! #include "Fl_Chart.H" forms_constructor(Fl_Chart, fl_add_chart) inline void fl_clear_chart(Fl_Widget* o) { ((Fl_Chart*)o)->clear();} inline void fl_add_chart_value(Fl_Widget* o,double v,const char* s,uchar c){ ((Fl_Chart*)o)->add(v,s,c);} inline void fl_insert_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { ((Fl_Chart*)o)->insert(i,v,s,c);} inline void fl_replace_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { ((Fl_Chart*)o)->replace(i,v,s,c);} inline void fl_set_chart_bounds(Fl_Widget* o, double a, double b) { ((Fl_Chart*)o)->bounds(a,b);} inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) { ((Fl_Chart*)o)->maxsize(v);} inline void fl_set_chart_autosize(Fl_Widget* o, int v) { ((Fl_Chart*)o)->autosize(v);} inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) { ((Fl_Chart*)o)->textfont(v);} inline void fl_set_chart_lsize(Fl_Widget* o, int v) { ((Fl_Chart*)o)->textsize(v);} inline void fl_set_chart_lcolor(Fl_Widget* o, Fl_Color v) { ((Fl_Chart*)o)->textcolor(v);} #define fl_set_chart_lcol fl_set_chart_lcolor #include "Fl_Choice.H" #define FL_NORMAL_CHOICE 0 #define FL_NORMAL_CHOICE2 0 #define FL_DROPLIST_CHOICE 0 forms_constructor(Fl_Choice, fl_add_choice) inline void fl_clear_choice(Fl_Widget* o) { ((Fl_Choice*)o)->clear();} inline void fl_addto_choice(Fl_Widget* o, const char* s) { ((Fl_Choice*)o)->add(s);} inline void fl_replace_choice(Fl_Widget* o, int i, const char* s) { ((Fl_Choice*)o)->replace(i-1,s);} inline void fl_delete_choice(Fl_Widget* o, int i) { ((Fl_Choice*)o)->remove(i-1);} inline void fl_set_choice(Fl_Widget* o, int i) { ((Fl_Choice*)o)->value(i-1);} // inline void fl_set_choice_text(Fl_Widget*, const char*); inline int fl_get_choice(Fl_Widget* o) { return ((Fl_Choice*)o)->value()+1;} // inline const char* fl_get_choice_item_text(Fl_Widget*, int); // inline int fl_get_choice_maxitems(Fl_Widget*); inline const char* fl_get_choice_text(Fl_Widget* o) { return ((Fl_Choice*)o)->text();} inline void fl_set_choice_fontsize(Fl_Widget* o, int x) { ((Fl_Choice*)o)->textsize(x);} inline void fl_set_choice_fontstyle(Fl_Widget* o, Fl_Font x) { ((Fl_Choice*)o)->textfont(x);} // inline void fl_set_choice_item_mode(Fl_Widget*, int, unsigned); // inline void fl_set_choice_item_shortcut(Fl_Widget*, int, const char*); #include "Fl_Clock.H" forms_constructort(Fl_Clock, fl_add_clock) inline void fl_get_clock(Fl_Widget* o, int* h, int* m, int* s) { *h = ((Fl_Clock*)o)->hour(); *m = ((Fl_Clock*)o)->minute(); *s = ((Fl_Clock*)o)->second(); } #include "Fl_Counter.H" forms_constructor(Fl_Counter, fl_add_counter) inline void fl_set_counter_value(Fl_Widget* o, double v) { ((Fl_Counter*)o)->value(v);} inline void fl_set_counter_bounds(Fl_Widget* o, double a, double b) { ((Fl_Counter*)o)->bounds(a,b);} inline void fl_set_counter_step(Fl_Widget* o, double a, double b) { ((Fl_Counter*)o)->step(a,b);} inline void fl_set_counter_precision(Fl_Widget* o, int v) { ((Fl_Counter*)o)->precision(v);} inline void fl_set_counter_return(Fl_Widget* o, int v) { ((Fl_Counter*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} inline double fl_get_counter_value(Fl_Widget* o) { return ((Fl_Counter*)o)->value();} inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) { *a = float(((Fl_Counter*)o)->minimum()); *b = float(((Fl_Counter*)o)->maximum()); } //inline void fl_set_counter_filter(Fl_Widget*,const char* (*)(Fl_Widget*,double,int)); // Cursor stuff cannot be emulated because it uses X stuff inline void fl_set_cursor(Fl_Window* w, Fl_Cursor c) {w->cursor(c);} #define FL_INVISIBLE_CURSOR FL_CURSOR_NONE #define FL_DEFAULT_CURSOR FL_CURSOR_DEFAULT #include "Fl_Dial.H" #define FL_DIAL_COL1 FL_GRAY #define FL_DIAL_COL2 37 forms_constructor(Fl_Dial, fl_add_dial) inline void fl_set_dial_value(Fl_Widget* o, double v) { ((Fl_Dial*)o)->value(v);} inline double fl_get_dial_value(Fl_Widget* o) { return ((Fl_Dial*)o)->value();} inline void fl_set_dial_bounds(Fl_Widget* o, double a, double b) { ((Fl_Dial*)o)->bounds(a, b);} inline void fl_get_dial_bounds(Fl_Widget* o, float* a, float* b) { *a = float(((Fl_Dial*)o)->minimum()); *b = float(((Fl_Dial*)o)->maximum()); } inline void fl_set_dial_return(Fl_Widget* o, int i) { ((Fl_Dial*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) { ((Fl_Dial*)o)->angles((short)a, (short)b);} //inline void fl_set_dial_cross(Fl_Widget* o, int); // inline void fl_set_dial_direction(Fl_Widget* o, uchar d) { // ((Fl_Dial*)o)->direction(d);} inline void fl_set_dial_step(Fl_Widget* o, double v) { ((Fl_Dial*)o)->step(v);} // Frames: inline Fl_Widget* fl_add_frame(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { return fl_add_box(i,x-3,y-3,w+6,h+6,l);} // labelframe nyi inline Fl_Widget* fl_add_labelframe(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { Fl_Widget* o = fl_add_box(i,x-3,y-3,w+6,h+6,l); o->align(FL_ALIGN_TOP_LEFT); return o; } #include "Fl_Free.H" inline Fl_Free* fl_add_free(int t,double x,double y,double w,double h,const char* l, FL_HANDLEPTR hdl) { return (Fl_Free*)(fl_add_new( new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl))); } #include "fl_ask.H" #include "fl_show_colormap.H" inline int fl_show_question(const char* c, int = 0) {return fl_choice("%s",fl_no,fl_yes,0L,c);} FL_EXPORT void fl_show_message(const char *,const char *,const char *); FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0); FL_EXPORT int fl_show_question(const char *,const char *,const char *); inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input("%s",d,l);} FL_EXPORT /*const*/ char *fl_show_simple_input(const char *label, const char *deflt = 0); FL_EXPORT int fl_show_choice( const char *m1, const char *m2, const char *m3, int numb, const char *b0, const char *b1, const char *b2); inline void fl_set_goodies_font(Fl_Font a, Fl_Fontsize b) {fl_message_font(a,b);} #define fl_show_messages fl_message inline int fl_show_choices(const char* c,int n,const char* b1,const char* b2, const char* b3, int) { return fl_show_choice(0,c,0,n,b1,b2,b3); } #include "filename.H" #include "Fl_File_Chooser.H" inline int do_matching(char* a, const char* b) {return fl_filename_match(a,b);} // Forms-compatible file chooser (implementation in fselect.C): FL_EXPORT char* fl_show_file_selector(const char* message,const char* dir, const char* pat,const char* fname); FL_EXPORT char* fl_get_directory(); FL_EXPORT char* fl_get_pattern(); FL_EXPORT char* fl_get_filename(); #include "Fl_Input.H" forms_constructor(Fl_Input, fl_add_input) inline void fl_set_input(Fl_Widget* o, const char* v) { ((Fl_Input*)o)->value(v);} inline void fl_set_input_return(Fl_Widget* o, int x) { ((Fl_Input*)o)->when((Fl_When)(x | FL_WHEN_RELEASE));} inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) { ((Fl_Input*)o)->textcolor(a); ((Fl_Input*)o)->cursor_color(b); } // inline void fl_set_input_scroll(Fl_Widget*, int); inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) { ((Fl_Input*)o)->insert_position(x);} // inline void fl_set_input_selected(Fl_Widget*, int); // inline void fl_set_input_selected_range(Fl_Widget*, int, int); // inline void fl_set_input_maxchars(Fl_Widget*, int); // inline void fl_set_input_format(Fl_Widget*, int, int); // inline void fl_set_input_hscrollbar(Fl_Widget*, int); // inline void fl_set_input_vscrollbar(Fl_Widget*, int); // inline void fl_set_input_xoffset(Fl_Widget*, int); // inline void fl_set_input_topline(Fl_Widget*, int); // inline void fl_set_input_scrollbarsize(Fl_Widget*, int, int); // inline int fl_get_input_topline(Fl_Widget*); // inline int fl_get_input_screenlines(Fl_Widget*); inline int fl_get_input_cursorpos(Fl_Widget* o, int*x, int*y) { *x = ((Fl_Input*)o)->insert_position(); *y = 0; return *x;} // inline int fl_get_input_numberoflines(Fl_Widget*); // inline void fl_get_input_format(Fl_Widget*, int*, int*); inline const char* fl_get_input(Fl_Widget* o) {return ((Fl_Input*)o)->value();} #include "Fl_Menu_Button.H" // types are not implemented, they all act like FL_PUSH_MENU: #define FL_TOUCH_MENU 0 #define FL_PUSH_MENU 1 #define FL_PULLDOWN_MENU 2 forms_constructor(Fl_Menu_Button, fl_add_menu) inline void fl_clear_menu(Fl_Widget* o) { ((Fl_Menu_Button*)o)->clear();} inline void fl_set_menu(Fl_Widget* o, const char* s) { ((Fl_Menu_Button*)o)->clear(); ((Fl_Menu_Button*)o)->add(s);} inline void fl_addto_menu(Fl_Widget* o, const char* s) { ((Fl_Menu_Button*)o)->add(s);} inline void fl_replace_menu_item(Fl_Widget* o, int i, const char* s) { ((Fl_Menu_Button*)o)->replace(i-1,s);} inline void fl_delete_menu_item(Fl_Widget* o, int i) { ((Fl_Menu_Button*)o)->remove(i-1);} inline void fl_set_menu_item_shortcut(Fl_Widget* o, int i, const char* s) { ((Fl_Menu_Button*)o)->shortcut(i-1,fl_old_shortcut(s));} inline void fl_set_menu_item_mode(Fl_Widget* o, int i, long x) { ((Fl_Menu_Button*)o)->mode(i-1,(int)x);} inline void fl_show_menu_symbol(Fl_Widget*, int ) { /* ((Fl_Menu_Button*)o)->show_menu_symbol(i); */} // inline void fl_set_menu_popup(Fl_Widget*, int); inline int fl_get_menu(Fl_Widget* o) { return ((Fl_Menu_Button*)o)->value()+1;} inline const char* fl_get_menu_item_text(Fl_Widget* o, int i) { return ((Fl_Menu_Button*)o)->text(i);} inline int fl_get_menu_maxitems(Fl_Widget* o) { return ((Fl_Menu_Button*)o)->size();} inline int fl_get_menu_item_mode(Fl_Widget* o, int i) { return ((Fl_Menu_Button*)o)->mode(i);} inline const char* fl_get_menu_text(Fl_Widget* o) { return ((Fl_Menu_Button*)o)->text();} #include "Fl_Positioner.H" #define FL_NORMAL_POSITIONER 0 forms_constructor(Fl_Positioner, fl_add_positioner) inline void fl_set_positioner_xvalue(Fl_Widget* o, double v) { ((Fl_Positioner*)o)->xvalue(v);} inline double fl_get_positioner_xvalue(Fl_Widget* o) { return ((Fl_Positioner*)o)->xvalue();} inline void fl_set_positioner_xbounds(Fl_Widget* o, double a, double b) { ((Fl_Positioner*)o)->xbounds(a,b);} inline void fl_get_positioner_xbounds(Fl_Widget* o, float* a, float* b) { *a = float(((Fl_Positioner*)o)->xminimum()); *b = float(((Fl_Positioner*)o)->xmaximum()); } inline void fl_set_positioner_yvalue(Fl_Widget* o, double v) { ((Fl_Positioner*)o)->yvalue(v);} inline double fl_get_positioner_yvalue(Fl_Widget* o) { return ((Fl_Positioner*)o)->yvalue();} inline void fl_set_positioner_ybounds(Fl_Widget* o, double a, double b) { ((Fl_Positioner*)o)->ybounds(a,b);} inline void fl_get_positioner_ybounds(Fl_Widget* o, float* a, float* b) { *a = float(((Fl_Positioner*)o)->yminimum()); *b = float(((Fl_Positioner*)o)->ymaximum()); } inline void fl_set_positioner_xstep(Fl_Widget* o, double v) { ((Fl_Positioner*)o)->xstep(v);} inline void fl_set_positioner_ystep(Fl_Widget* o, double v) { ((Fl_Positioner*)o)->ystep(v);} inline void fl_set_positioner_return(Fl_Widget* o, int v) { ((Fl_Positioner*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} #include "Fl_Slider.H" #define FL_HOR_BROWSER_SLIDER FL_HOR_SLIDER #define FL_VERT_BROWSER_SLIDER FL_VERT_SLIDER forms_constructort(Fl_Slider, fl_add_slider) #define FL_SLIDER_COL1 FL_GRAY inline void fl_set_slider_value(Fl_Widget* o, double v) { ((Fl_Slider*)o)->value(v);} inline double fl_get_slider_value(Fl_Widget* o) { return ((Fl_Slider*)o)->value();} inline void fl_set_slider_bounds(Fl_Widget* o, double a, double b) { ((Fl_Slider*)o)->bounds(a, b);} inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) { *a = float(((Fl_Slider*)o)->minimum()); *b = float(((Fl_Slider*)o)->maximum()); } inline void fl_set_slider_return(Fl_Widget* o, int i) { ((Fl_Slider*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} inline void fl_set_slider_step(Fl_Widget* o, double v) { ((Fl_Slider*)o)->step(v);} // inline void fl_set_slider_increment(Fl_Widget* o, double v, double); inline void fl_set_slider_size(Fl_Widget* o, double v) { ((Fl_Slider*)o)->slider_size(v);} #include "Fl_Value_Slider.H" forms_constructor(Fl_Value_Slider, fl_add_valslider) inline void fl_set_slider_precision(Fl_Widget* o, int i) { ((Fl_Value_Slider*)o)->precision(i);} // filter function! // The forms text object was the same as an Fl_Box except it inverted the // meaning of FL_ALIGN_INSIDE. Implementation in forms.cxx class FL_EXPORT Fl_FormsText : public Fl_Widget { protected: void draw() FL_OVERRIDE; public: Fl_FormsText(Fl_Boxtype b, int X, int Y, int W, int H, const char* l=0) : Fl_Widget(X,Y,W,H,l) {box(b); align(FL_ALIGN_LEFT);} }; #define FL_NORMAL_TEXT FL_NO_BOX forms_constructorb(Fl_FormsText, fl_add_text) #include "Fl_Timer.H" forms_constructort(Fl_Timer, fl_add_timer) inline void fl_set_timer(Fl_Widget* o, double v) {((Fl_Timer*)o)->value(v);} inline double fl_get_timer(Fl_Widget* o) {return ((Fl_Timer*)o)->value();} inline void fl_suspend_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(1);} inline void fl_resume_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(0);} inline void fl_set_timer_countup(Fl_Widget* o,char d) {((Fl_Timer*)o)->direction(d);} void FL_EXPORT fl_gettime(long* sec, long* usec); // Fl_XYPlot nyi // stuff from DDForms: inline int fl_double_click() {return Fl::event_clicks();} inline void fl_draw() {Fl::flush();} #endif /* define __FORMS_H__ */ ================================================ FILE: Game Trainers/common/include/FL/gl.h ================================================ // // OpenGL header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. // // You must include this instead of GL/gl.h to get the Microsoft // APIENTRY stuff included (from ) prior to the OpenGL // header files. // // This file also provides "missing" OpenGL functions, and // gl_start() and gl_finish() to allow OpenGL to be used in any window // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // /** \file gl.h This file defines wrapper functions for OpenGL in FLTK To use OpenGL from within an FLTK application you MUST use gl_visual() to select the default visual before doing show() on any windows. Mesa will crash if you try to use a visual not returned by glxChooseVisual. Historically, this did not always work well with Fl_Double_Window's! It can try to draw into the front buffer. Depending on the system this might either crash or do nothing (when pixmaps are being used as back buffer and GL is being done by hardware), work correctly (when GL is done with software, such as Mesa), or draw into the front buffer and be erased when the buffers are swapped (when double buffer hardware is being used) */ #ifndef FL_gl_H # define FL_gl_H # include "Enumerations.H" // for color names # ifdef _WIN32 # include # endif # ifndef APIENTRY # if defined(__CYGWIN__) # define APIENTRY __attribute__ ((__stdcall__)) # else # define APIENTRY # endif # endif # ifdef __APPLE__ // PORTME: OpenGL path abstraction # ifndef GL_SILENCE_DEPRECATION # define GL_SILENCE_DEPRECATION 1 # endif # if !defined(__gl3_h_) // make sure OpenGL/gl3.h was not included before # include # endif # else # include # endif // __APPLE__ // PORTME: OpenGL Path abstraction FL_EXPORT void gl_start(); FL_EXPORT void gl_finish(); FL_EXPORT void gl_color(Fl_Color i); /** back compatibility */ inline void gl_color(int c) {gl_color((Fl_Color)c);} FL_EXPORT void gl_rect(int x,int y,int w,int h); FL_EXPORT void gl_rectf(int x,int y,int w,int h); FL_EXPORT void gl_font(int fontid, int size); FL_EXPORT int gl_height(); FL_EXPORT int gl_descent(); FL_EXPORT double gl_width(const char *); FL_EXPORT double gl_width(const char *, int n); FL_EXPORT double gl_width(uchar); FL_EXPORT void gl_draw(const char*); FL_EXPORT void gl_draw(const char*, int n); FL_EXPORT void gl_draw(const char*, int x, int y); FL_EXPORT void gl_draw(const char*, float x, float y); FL_EXPORT void gl_draw(const char*, int n, int x, int y); FL_EXPORT void gl_draw(const char*, int n, float x, float y); FL_EXPORT void gl_draw(const char*, int x, int y, int w, int h, Fl_Align); FL_EXPORT void gl_measure(const char*, int& x, int& y); FL_EXPORT void gl_texture_pile_height(int max); FL_EXPORT int gl_texture_pile_height(); FL_EXPORT void gl_texture_reset(); FL_EXPORT void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0); #endif // !FL_gl_H ================================================ FILE: Game Trainers/common/include/FL/gl2opengl.h ================================================ /* gl.h GL to OpenGL translator. If you include this, you might be able to port old GL programs. There are also much better emulators available on the net. */ #ifndef _FL_gl2opengl_h_ #define _FL_gl2opengl_h_ #include #include "gl_draw.H" inline void clear() {glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);} #define RGBcolor(r,g,b) glColor3ub(r,g,b) #define bgnline() glBegin(GL_LINE_STRIP) #define bgnpolygon() glBegin(GL_POLYGON) #define bgnclosedline() glBegin(GL_LINE_LOOP) #define endline() glEnd() #define endpolygon() glEnd() #define endclosedline() glEnd() #define v2f(v) glVertex2fv(v) #define v2s(v) glVertex2sv(v) #define cmov(x,y,z) glRasterPos3f(x,y,z) #define charstr(s) gl_draw(s) #define fmprstr(s) gl_draw(s) typedef float Matrix[4][4]; inline void pushmatrix() {glPushMatrix();} inline void popmatrix() {glPopMatrix();} inline void multmatrix(Matrix m) {glMultMatrixf((float *)m);} inline void color(int n) {glIndexi(n);} inline void rect(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} inline void rectf(int x,int y,int r,int t) {glRectf(x,y,r+1,t+1);} inline void recti(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} inline void rectfi(int x,int y,int r,int t) {glRecti(x,y,r+1,t+1);} inline void rects(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);} inline void rectfs(int x,int y,int r,int t) {glRects(x,y,r+1,t+1);} #endif /* _FL_gl2opengl_h_ */ ================================================ FILE: Game Trainers/common/include/FL/gl_draw.H ================================================ // // OpenGL header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #include "gl.h" extern FL_EXPORT void gl_remove_displaylist_fonts(); ================================================ FILE: Game Trainers/common/include/FL/glu.h ================================================ // // GLu header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2010 by Bill Spitzak and others. // // You must include this instead of GL/gl.h to get the Microsoft // APIENTRY stuff included (from ) prior to the OpenGL // header files. // // This file also provides "missing" OpenGL functions, and // gl_start() and gl_finish() to allow OpenGL to be used in any window // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #ifndef FL_glu_H # define FL_glu_H # include "Enumerations.H" // for color names # ifdef _WIN32 # include # endif # ifndef APIENTRY # if defined(__CYGWIN__) # define APIENTRY __attribute__ ((__stdcall__)) # else # define APIENTRY # endif # endif # ifdef __APPLE__ // PORTME: OpenGL Path abstraction # include # else # include # endif #endif // !FL_glu_H ================================================ FILE: Game Trainers/common/include/FL/glut.H ================================================ // // GLUT emulation header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Emulation of GLUT using fltk. // GLUT is Copyright (c) Mark J. Kilgard, 1994, 1995, 1996: // "This program is freely distributable without licensing fees and is // provided without guarantee or warrantee expressed or implied. This // program is -not- in the public domain." // Although I have copied the GLUT API, none of my code is based on // any GLUT implementation details and is therefore covered by the LGPL. // Commented out lines indicate parts of GLUT that are not emulated. // Notes: as pointed out in STR #3458 the current GLUT window, // i.e. the global static variable 'glut_window' can be NULL ... // (a) if not (yet) initialized // (b) if the current GLUT window is deleted at any time. // The FLTK implementation silently ignores function calls if the current // window is NULL to avoid dereferencing a NULL pointer. This is obviously // compatible with GLUT version 3.7 according to comment #5 on STR #3458. // According to the same comment FreeGLUT 3.0 would issue an error message // and quit. // Albrecht-S, Oct 2023 #ifndef _FL_glut_H_ # define _FL_glut_H_ # include "gl.h" # include "Fl.H" # include "Fl_Gl_Window.H" /** GLUT is emulated using this window class and these static variables (plus several more static variables hidden in glut_compatibility.cxx): */ class FL_EXPORT Fl_Glut_Window : public Fl_Gl_Window { void _init(); int mouse_down; protected: void draw() FL_OVERRIDE; void draw_overlay() FL_OVERRIDE; int handle(int) FL_OVERRIDE; public: // so the inline functions work int number; int menu[3]; void make_current(); void (*display)(); void (*overlaydisplay)(); void (*reshape)(int w, int h); void (*keyboard)(uchar, int x, int y); void (*mouse)(int b, int state, int x, int y); void (*motion)(int x, int y); void (*passivemotion)(int x, int y); void (*entry)(int); void (*visibility)(int); void (*special)(int, int x, int y); Fl_Glut_Window(int w, int h, const char *t=0); Fl_Glut_Window(int x, int y, int w, int h, const char *t=0); ~Fl_Glut_Window(); }; extern FL_EXPORT Fl_Glut_Window *glut_window; // the current window extern FL_EXPORT int glut_menu; // the current menu // function pointers that are not per-window: extern FL_EXPORT void (*glut_idle_function)(); extern FL_EXPORT void (*glut_menustate_function)(int); extern FL_EXPORT void (*glut_menustatus_function)(int,int,int); //////////////////////////////////////////////////////////////// //# define GLUT_API_VERSION This does not match any version of GLUT exactly... FL_EXPORT void glutInit(int *argcp, char **argv); // creates first window FL_EXPORT void glutInitDisplayMode(unsigned int mode); // the FL_ symbols have the same value as the GLUT ones: # define GLUT_RGB FL_RGB # define GLUT_RGBA FL_RGB # define GLUT_INDEX FL_INDEX # define GLUT_SINGLE FL_SINGLE # define GLUT_DOUBLE FL_DOUBLE # define GLUT_ACCUM FL_ACCUM # define GLUT_ALPHA FL_ALPHA # define GLUT_DEPTH FL_DEPTH # define GLUT_STENCIL FL_STENCIL # define GLUT_MULTISAMPLE FL_MULTISAMPLE # define GLUT_STEREO FL_STEREO // # define GLUT_LUMINANCE 512 FL_EXPORT void glutInitWindowPosition(int x, int y); FL_EXPORT void glutInitWindowSize(int w, int h); FL_EXPORT void glutMainLoop(); FL_EXPORT int glutCreateWindow(char *title); FL_EXPORT int glutCreateWindow(const char *title); FL_EXPORT int glutCreateSubWindow(int win, int x, int y, int width, int height); FL_EXPORT void glutDestroyWindow(int win); inline void glutPostRedisplay() { if (glut_window) glut_window->redraw(); } FL_EXPORT void glutPostWindowRedisplay(int win); FL_EXPORT void glutSwapBuffers(); inline int glutGetWindow() { return glut_window ? glut_window->number : 0; } FL_EXPORT void glutSetWindow(int win); inline void glutSetWindowTitle(char *t) { if (glut_window) glut_window->label(t); } inline void glutSetIconTitle(char *t) { if (glut_window) glut_window->iconlabel(t); } inline void glutPositionWindow(int x, int y) { if (glut_window) glut_window->position(x,y); } inline void glutReshapeWindow(int w, int h) { if (glut_window) glut_window->size(w,h); } inline void glutPopWindow() { if (glut_window) glut_window->show(); } inline void glutPushWindow() { /* do nothing */ } inline void glutIconifyWindow() { if (glut_window) glut_window->iconize(); } inline void glutShowWindow() { if (glut_window) glut_window->show(); } inline void glutHideWindow() { if (glut_window) glut_window->hide(); } inline void glutFullScreen() { if (glut_window) glut_window->fullscreen(); } inline void glutSetCursor(Fl_Cursor cursor) { if (glut_window) glut_window->cursor(cursor); } // notice that the numeric values are different than glut: # define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2) # define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67) # define GLUT_CURSOR_INFO FL_CURSOR_HAND # define GLUT_CURSOR_DESTROY ((Fl_Cursor)45) # define GLUT_CURSOR_HELP FL_CURSOR_HELP # define GLUT_CURSOR_CYCLE ((Fl_Cursor)26) # define GLUT_CURSOR_SPRAY ((Fl_Cursor)63) # define GLUT_CURSOR_WAIT FL_CURSOR_WAIT # define GLUT_CURSOR_TEXT FL_CURSOR_INSERT # define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS # define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS # define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE # define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N # define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S # define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W # define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E # define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW # define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE # define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE # define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW # define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT # define GLUT_CURSOR_NONE FL_CURSOR_NONE # define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS inline void glutWarpPointer(int, int) { /* do nothing */ } inline void glutEstablishOverlay() { if (glut_window) glut_window->make_overlay_current(); } inline void glutRemoveOverlay() { if (glut_window) glut_window->hide_overlay(); } inline void glutUseLayer(GLenum layer) { if (!glut_window) return; layer ? glut_window->make_overlay_current() : glut_window->make_current(); } enum {GLUT_NORMAL, GLUT_OVERLAY}; inline void glutPostOverlayRedisplay() { if (glut_window) glut_window->redraw_overlay(); } inline void glutShowOverlay() { if (glut_window) glut_window->redraw_overlay(); } inline void glutHideOverlay() { if (glut_window) glut_window->hide_overlay(); } FL_EXPORT int glutCreateMenu(void (*)(int)); FL_EXPORT void glutDestroyMenu(int menu); inline int glutGetMenu() {return glut_menu;} inline void glutSetMenu(int m) {glut_menu = m;} FL_EXPORT void glutAddMenuEntry(const char *label, int value); FL_EXPORT void glutAddSubMenu(char *label, int submenu); FL_EXPORT void glutChangeToMenuEntry(int item, char *labela, int value); FL_EXPORT void glutChangeToSubMenu(int item, char *label, int submenu); FL_EXPORT void glutRemoveMenuItem(int item); inline void glutAttachMenu(int b) { if (glut_window) glut_window->menu[b] = glut_menu; } inline void glutDetachMenu(int b) { if (glut_window) glut_window->menu[b] = 0; } inline void glutDisplayFunc(void (*f)()) { if (glut_window) glut_window->display = f; } inline void glutReshapeFunc(void (*f)(int w, int h)) { if (glut_window) glut_window->reshape = f; } inline void glutKeyboardFunc(void (*f)(uchar key, int x, int y)) { if (glut_window) glut_window->keyboard = f; } inline void glutMouseFunc(void (*f)(int b, int state, int x, int y)) { if (glut_window) glut_window->mouse = f; } # define GLUT_LEFT_BUTTON 0 # define GLUT_MIDDLE_BUTTON 1 # define GLUT_RIGHT_BUTTON 2 # define GLUT_DOWN 0 # define GLUT_UP 1 inline void glutMotionFunc(void (*f)(int x, int y)) { if (glut_window) glut_window->motion = f; } inline void glutPassiveMotionFunc(void (*f)(int x, int y)) { if (glut_window) glut_window->passivemotion = f; } inline void glutEntryFunc(void (*f)(int s)) { if (glut_window) glut_window->entry = f; } enum {GLUT_LEFT, GLUT_ENTERED}; inline void glutVisibilityFunc(void (*f)(int s)) { if (glut_window) glut_window->visibility = f; } enum {GLUT_NOT_VISIBLE, GLUT_VISIBLE}; FL_EXPORT void glutIdleFunc(void (*f)()); inline void glutTimerFunc(unsigned int msec, void (*f)(int), int value) { Fl::add_timeout(msec*.001, (void (*)(void *))f, (void *)(fl_intptr_t)value); } inline void glutMenuStateFunc(void (*f)(int state)) { glut_menustate_function = f;} inline void glutMenuStatusFunc(void (*f)(int status, int x, int y)) { glut_menustatus_function = f;} enum {GLUT_MENU_NOT_IN_USE, GLUT_MENU_IN_USE}; inline void glutSpecialFunc(void (*f)(int key, int x, int y)) { if (glut_window) glut_window->special = f; } # define GLUT_KEY_F1 1 # define GLUT_KEY_F2 2 # define GLUT_KEY_F3 3 # define GLUT_KEY_F4 4 # define GLUT_KEY_F5 5 # define GLUT_KEY_F6 6 # define GLUT_KEY_F7 7 # define GLUT_KEY_F8 8 # define GLUT_KEY_F9 9 # define GLUT_KEY_F10 10 # define GLUT_KEY_F11 11 # define GLUT_KEY_F12 12 // WARNING: Different values than GLUT uses: # define GLUT_KEY_LEFT FL_Left # define GLUT_KEY_UP FL_Up # define GLUT_KEY_RIGHT FL_Right # define GLUT_KEY_DOWN FL_Down # define GLUT_KEY_PAGE_UP FL_Page_Up # define GLUT_KEY_PAGE_DOWN FL_Page_Down # define GLUT_KEY_HOME FL_Home # define GLUT_KEY_END FL_End # define GLUT_KEY_INSERT FL_Insert // inline void glutSpaceballMotionFunc(void (*)(int x, int y, int z)); // inline void glutSpaceballRotateFunc(void (*)(int x, int y, int z)); // inline void glutSpaceballButtonFunc(void (*)(int button, int state)); // inline void glutButtonBoxFunc(void (*)(int button, int state)); // inline void glutDialsFunc(void (*)(int dial, int value)); // inline void glutTabletMotionFunc(void (*)(int x, int y)); // inline void glutTabletButtonFunc(void (*)(int button, int state, int x, int y)); inline void glutOverlayDisplayFunc(void (*f)()) { if (glut_window) glut_window->overlaydisplay = f; } // inline void glutWindowStatusFunc(void (*)(int state)); // enum {GLUT_HIDDEN, GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED, // GLUT_FULLY_COVERED}; // inline void glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue); // inline GLfloat glutGetColor(int ndx, int component); // #define GLUT_RED 0 // #define GLUT_GREEN 1 // #define GLUT_BLUE 2 // inline void glutCopyColormap(int win); // Warning: values are changed from GLUT! // Also relies on the GL_ symbols having values greater than 100 FL_EXPORT int glutGet(GLenum type); enum { GLUT_RETURN_ZERO = 0, GLUT_WINDOW_X, GLUT_WINDOW_Y, GLUT_WINDOW_WIDTH, GLUT_WINDOW_HEIGHT, GLUT_WINDOW_PARENT, GLUT_SCREEN_WIDTH, GLUT_SCREEN_HEIGHT, GLUT_MENU_NUM_ITEMS, GLUT_DISPLAY_MODE_POSSIBLE, GLUT_INIT_WINDOW_X, GLUT_INIT_WINDOW_Y, GLUT_INIT_WINDOW_WIDTH, GLUT_INIT_WINDOW_HEIGHT, GLUT_INIT_DISPLAY_MODE, GLUT_WINDOW_BUFFER_SIZE, GLUT_VERSION, //GLUT_WINDOW_NUM_CHILDREN, //GLUT_WINDOW_CURSOR, //GLUT_SCREEN_WIDTH_MM, //GLUT_SCREEN_HEIGHT_MM, GLUT_ELAPSED_TIME }; # define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS # define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS # define GLUT_WINDOW_RED_SIZE GL_RED_BITS # define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS # define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS # define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS # define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS # define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS # define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS # define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS # define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER # define GLUT_WINDOW_RGBA GL_RGBA # define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS # ifdef GL_SAMPLES_SGIS # define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS # else # define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO # endif # define GLUT_WINDOW_STEREO GL_STEREO # define GLUT_HAS_KEYBOARD 600 # define GLUT_HAS_MOUSE 601 # define GLUT_HAS_SPACEBALL 602 # define GLUT_HAS_DIAL_AND_BUTTON_BOX 603 # define GLUT_HAS_TABLET 604 # define GLUT_NUM_MOUSE_BUTTONS 605 # define GLUT_NUM_SPACEBALL_BUTTONS 606 # define GLUT_NUM_BUTTON_BOX_BUTTONS 607 # define GLUT_NUM_DIALS 608 # define GLUT_NUM_TABLET_BUTTONS 609 FL_EXPORT int glutDeviceGet(GLenum type); // WARNING: these values are different than GLUT uses: # define GLUT_ACTIVE_SHIFT FL_SHIFT # define GLUT_ACTIVE_CTRL FL_CTRL # define GLUT_ACTIVE_ALT FL_ALT inline int glutGetModifiers() { return Fl::event_state() & (GLUT_ACTIVE_SHIFT | GLUT_ACTIVE_CTRL | GLUT_ACTIVE_ALT); } FL_EXPORT int glutLayerGet(GLenum); # define GLUT_OVERLAY_POSSIBLE 800 //#define GLUT_LAYER_IN_USE 801 //#define GLUT_HAS_OVERLAY 802 # define GLUT_TRANSPARENT_INDEX 803 # define GLUT_NORMAL_DAMAGED 804 # define GLUT_OVERLAY_DAMAGED 805 extern "C" { typedef void (*GLUTproc)(); } FL_EXPORT GLUTproc glutGetProcAddress(const char *procName); // inline int glutVideoResizeGet(GLenum param); // #define GLUT_VIDEO_RESIZE_POSSIBLE 900 // #define GLUT_VIDEO_RESIZE_IN_USE 901 // #define GLUT_VIDEO_RESIZE_X_DELTA 902 // #define GLUT_VIDEO_RESIZE_Y_DELTA 903 // #define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904 // #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905 // #define GLUT_VIDEO_RESIZE_X 906 // #define GLUT_VIDEO_RESIZE_Y 907 // #define GLUT_VIDEO_RESIZE_WIDTH 908 // #define GLUT_VIDEO_RESIZE_HEIGHT 909 // inline void glutSetupVideoResizing(); // inline void glutStopVideoResizing(); // inline void glutVideoResize(int x, int y, int width, int height); // inline void glutVideoPan(int x, int y, int width, int height); // Font argument must be a void* for compatibility, so... /** fltk glut font/size attributes used in the glutXXX functions */ struct Fl_Glut_Bitmap_Font {Fl_Font font; Fl_Fontsize size;}; extern FL_EXPORT struct Fl_Glut_Bitmap_Font glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18; # define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15) # define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13) # define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10) # define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24) # define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10) # define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12) # define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18) FL_EXPORT void glutBitmapCharacter(void *font, int character); FL_EXPORT int glutBitmapHeight(void *font); FL_EXPORT int glutBitmapLength(void *font, const unsigned char *string); FL_EXPORT void glutBitmapString(void *font, const unsigned char *string); FL_EXPORT int glutBitmapWidth(void *font, int character); FL_EXPORT int glutExtensionSupported(char *name); /* GLUT stroked font sub-API */ struct Fl_Glut_StrokeVertex { GLfloat X, Y; }; struct Fl_Glut_StrokeStrip { int Number; const Fl_Glut_StrokeVertex* Vertices; }; struct Fl_Glut_StrokeChar { GLfloat Right; int Number; const Fl_Glut_StrokeStrip* Strips; }; struct Fl_Glut_StrokeFont { char* Name; // The source font name int Quantity; // Number of chars in font GLfloat Height; // Height of the characters const Fl_Glut_StrokeChar** Characters;// The characters mapping }; extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeRoman; extern FL_EXPORT Fl_Glut_StrokeFont glutStrokeMonoRoman; # define GLUT_STROKE_ROMAN (&glutStrokeRoman) # define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman) FL_EXPORT void glutStrokeCharacter(void *font, int character); FL_EXPORT GLfloat glutStrokeHeight(void *font); FL_EXPORT int glutStrokeLength(void *font, const unsigned char *string); FL_EXPORT void glutStrokeString(void *font, const unsigned char *string); FL_EXPORT int glutStrokeWidth(void *font, int character); /* GLUT pre-built models sub-API */ FL_EXPORT void glutWireSphere(GLdouble radius, GLint slices, GLint stacks); FL_EXPORT void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); FL_EXPORT void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); FL_EXPORT void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); FL_EXPORT void glutWireCube(GLdouble size); FL_EXPORT void glutSolidCube(GLdouble size); FL_EXPORT void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); FL_EXPORT void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); FL_EXPORT void glutWireDodecahedron(); FL_EXPORT void glutSolidDodecahedron(); FL_EXPORT void glutWireTeapot(GLdouble size); FL_EXPORT void glutSolidTeapot(GLdouble size); FL_EXPORT void glutWireOctahedron(); FL_EXPORT void glutSolidOctahedron(); FL_EXPORT void glutWireTetrahedron(); FL_EXPORT void glutSolidTetrahedron(); FL_EXPORT void glutWireIcosahedron(); FL_EXPORT void glutSolidIcosahedron(); #endif // !_FL_glut_H_ ================================================ FILE: Game Trainers/common/include/FL/mac.H ================================================ // // Mac header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Do not directly include this file, instead use . It will // include this file if "__APPLE__" is defined. This is to encourage // portability of even the system-specific code... #ifndef FL_DOXYGEN #if !defined(FL_PLATFORM_H) # error "Never use directly; include instead." #endif // !FL_PLATFORM_H #ifdef __OBJC__ @class NSOpenGLContext; # ifndef GL_SILENCE_DEPRECATION # define GL_SILENCE_DEPRECATION 1 # endif #elif defined(__cplusplus) class NSOpenGLContext; #endif /* __OBJC__ */ extern NSOpenGLContext *fl_mac_glcontext(GLContext rc); #ifdef __OBJC__ @class FLWindow; // a subclass of the NSWindow Cocoa class typedef FLWindow *Window; #else typedef class FLWindow *Window; // pointer to the FLWindow objective-c class #endif // __OBJC__ #include // for Fl_Callback #if (defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part must be compiled when building the FLTK libraries // Standard MacOS C/C++ includes... #include #undef check // because of Fl::check() #ifndef MAC_OS_X_VERSION_10_4 #define MAC_OS_X_VERSION_10_4 1040 #endif #ifndef MAC_OS_X_VERSION_10_5 #define MAC_OS_X_VERSION_10_5 1050 #endif #ifndef MAC_OS_X_VERSION_10_6 #define MAC_OS_X_VERSION_10_6 1060 #endif #ifndef MAC_OS_X_VERSION_10_7 #define MAC_OS_X_VERSION_10_7 1070 #endif #ifndef MAC_OS_X_VERSION_10_8 #define MAC_OS_X_VERSION_10_8 1080 #endif #ifndef MAC_OS_X_VERSION_10_9 #define MAC_OS_X_VERSION_10_9 1090 #endif #ifndef MAC_OS_X_VERSION_10_10 #define MAC_OS_X_VERSION_10_10 101000 #endif #ifndef MAC_OS_X_VERSION_10_11 #define MAC_OS_X_VERSION_10_11 101100 #endif #ifndef MAC_OS_X_VERSION_10_12 #define MAC_OS_X_VERSION_10_12 101200 #endif #ifndef MAC_OS_X_VERSION_10_13 #define MAC_OS_X_VERSION_10_13 101300 #endif #ifndef MAC_OS_X_VERSION_10_14 #define MAC_OS_X_VERSION_10_14 101400 #endif #ifndef MAC_OS_X_VERSION_10_15 #define MAC_OS_X_VERSION_10_15 101500 #endif #ifndef MAC_OS_X_VERSION_10_16 #define MAC_OS_X_VERSION_10_16 101600 #endif #ifndef MAC_OS_VERSION_11_0 #define MAC_OS_VERSION_11_0 110000 #endif #ifndef MAC_OS_VERSION_12_0 #define MAC_OS_VERSION_12_0 120000 #endif #ifndef MAC_OS_VERSION_13_0 #define MAC_OS_VERSION_13_0 130000 #endif #ifndef MAC_OS_VERSION_14_0 #define MAC_OS_VERSION_14_0 140000 #endif #ifndef MAC_OS_VERSION_15_0 #define MAC_OS_VERSION_15_0 150000 #endif #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h #if defined(__LP64__) && __LP64__ typedef long NSInteger; typedef unsigned long NSUInteger; #else typedef int NSInteger; typedef unsigned int NSUInteger; #endif #endif #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 typedef CGImageAlphaInfo CGBitmapInfo; #endif struct flCocoaRegion { int count; CGRect *rects; }; // a region is the union of a series of rectangles #ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h #if defined(__LP64__) && __LP64__ typedef double CGFloat; #else typedef float CGFloat; #endif #endif // CGFLOAT_DEFINED #else typedef struct CGContext* CGContextRef; #endif // FL_LIBRARY || FL_INTERNALS extern CGContextRef fl_gc; #endif // FL_DOXYGEN /** \file Mac OS X-specific symbols. */ /** \defgroup group_macosx Mac OS X-specific symbols Mac OS X-specific symbols declared in \sa \ref osissues_macos \{ */ /** Attaches a callback to the "About myprog" item of the system application menu. For back-compatibility. Equivalent to Fl_Sys_Menu_Bar::about(Fl_Callback *cb, void *user_data). */ void fl_mac_set_about(Fl_Callback *cb, void *user_data, int shortcut = 0); /** Returns the macOS-specific graphics context for the current window */ extern CGContextRef fl_mac_gc(); /** Returns the macOS-specific window reference corresponding to the given Fl_Window object */ extern FLWindow *fl_mac_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to the given macOS-specific window reference */ extern Fl_Window *fl_mac_find(FLWindow *); class Fl_Gl_Window; /** The version number of the running Mac OS X (e.g., 100604 for 10.6.4, 101300 for 10.13, 140102 for 14.1.2). FLTK initializes this global variable before main() begins running. If the value is needed in a static initializer, a previous call to Fl::system_driver() makes sure \ref fl_mac_os_version has been initialized. */ extern int fl_mac_os_version; struct Fl_Menu_Item; class Fl_Mac_App_Menu { public: /** Localizable text for the "About xxx" application menu item */ static const char *about; /** Localizable text for the "Print Front Window" application menu item. This menu item and next one won't be displayed if Fl_Mac_App_Menu::print is set to an empty string. */ static const char *print; /** Localizable text for the "Print Front Window" application menu item. */ static const char *print_no_titlebar; /** Localizable text for the "Toggle print titlebar" application menu item. */ static const char *toggle_print_titlebar; /** Localizable text for the "Services" application menu item */ static const char *services; /** Localizable text for the "Hide xxx" application menu item */ static const char *hide; /** Localizable text for the "Hide Others" application menu item */ static const char *hide_others; /** Localizable text for the "Show All" application menu item */ static const char *show; /** Localizable text for the "Quit xxx" application menu item */ static const char *quit; /** Adds custom menu item(s) to the application menu of the system menu bar. They are positioned after the "Print Front Window / Toggle printing of titlebar" items, or at their place if they were removed with Fl_Mac_App_Menu::print = "". \param m zero-ending array of Fl_Menu_Item 's. */ static void custom_application_menu_items(const Fl_Menu_Item *m); }; /** @} */ ================================================ FILE: Game Trainers/common/include/FL/math.h ================================================ // // Math header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Xcode on macOS includes files by recursing down into directories. // This code catches the cycle and directly includes the required file. #ifdef fl_math_h_cyclic_include # include "/usr/include/math.h" #endif #ifndef fl_math_h # define fl_math_h # define fl_math_h_cyclic_include # include # undef fl_math_h_cyclic_include # ifndef M_PI # define M_PI 3.14159265358979323846 # define M_PI_2 1.57079632679489661923 # define M_PI_4 0.78539816339744830962 # define M_1_PI 0.31830988618379067154 # define M_2_PI 0.63661977236758134308 # endif // !M_PI # ifndef M_SQRT2 # define M_SQRT2 1.41421356237309504880 # define M_SQRT1_2 0.70710678118654752440 # endif // !M_SQRT2 # if (defined(_WIN32) || defined(CRAY)) && !defined(__MINGW32__) inline double rint(double v) {return floor(v+.5);} inline double copysign(double a, double b) {return b<0 ? -a : a;} # endif // (_WIN32 || CRAY) && !__MINGW32__ #endif // !fl_math_h ================================================ FILE: Game Trainers/common/include/FL/names.h ================================================ // // Event and other names header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Thanks to Greg Ercolano for this addition. /** \file names.h This file defines arrays of human readable names for FLTK symbolic constants. */ #ifndef FL_NAMES_H #define FL_NAMES_H /** \defgroup fl_events Events handling functions @{ */ /** This is an array of event names you can use to convert event numbers into names. The array gets defined inline wherever your '\#include ' appears. \b Example: \code #include // array will be defined here int MyClass::handle(int e) { printf("Event was %s (%d)\n", fl_eventnames[e], e); // ..resulting output might be e.g. "Event was FL_PUSH (1)".. [..] } \endcode */ const char * const fl_eventnames[] = { "FL_NO_EVENT", "FL_PUSH", "FL_RELEASE", "FL_ENTER", "FL_LEAVE", "FL_DRAG", "FL_FOCUS", "FL_UNFOCUS", "FL_KEYDOWN", "FL_KEYUP", "FL_CLOSE", "FL_MOVE", "FL_SHORTCUT", "FL_DEACTIVATE", "FL_ACTIVATE", "FL_HIDE", "FL_SHOW", "FL_PASTE", "FL_SELECTIONCLEAR", "FL_MOUSEWHEEL", "FL_DND_ENTER", "FL_DND_DRAG", "FL_DND_LEAVE", "FL_DND_RELEASE", "FL_SCREEN_CONFIGURATION_CHANGED", "FL_FULLSCREEN", "FL_ZOOM_GESTURE", "FL_ZOOM_EVENT", "FL_EVENT_28", // not yet defined, just in case it /will/ be defined ... "FL_EVENT_29", // not yet defined, just in case it /will/ be defined ... "FL_EVENT_30" // not yet defined, just in case it /will/ be defined ... }; /** This is an array of font names you can use to convert font numbers into names. The array gets defined inline wherever your '\#include ' appears. \b Example: \code #include // array will be defined here int MyClass::my_callback(Fl_Widget *w, void*) { int fnum = w->labelfont(); // Resulting output might be e.g. "Label's font is FL_HELVETICA (0)" printf("Label's font is %s (%d)\n", fl_fontnames[fnum], fnum); // ..resulting output might be e.g. "Label's font is FL_HELVETICA (0)".. [..] } \endcode */ const char * const fl_fontnames[] = { "FL_HELVETICA", "FL_HELVETICA_BOLD", "FL_HELVETICA_ITALIC", "FL_HELVETICA_BOLD_ITALIC", "FL_COURIER", "FL_COURIER_BOLD", "FL_COURIER_ITALIC", "FL_COURIER_BOLD_ITALIC", "FL_TIMES", "FL_TIMES_BOLD", "FL_TIMES_ITALIC", "FL_TIMES_BOLD_ITALIC", "FL_SYMBOL", "FL_SCREEN", "FL_SCREEN_BOLD", "FL_ZAPF_DINGBATS", }; /** This is an array of callback reason names you can use to convert callback reasons into names. The array gets defined inline wherever your '\#include ' appears. */ const char * const fl_callback_reason_names[] = { "FL_REASON_UNKNOWN", "FL_REASON_SELECTED", "FL_REASON_DESELECTED", "FL_REASON_RESELECTED", "FL_REASON_OPENED", "FL_REASON_CLOSED", "FL_REASON_DRAGGED", "FL_REASON_CANCELLED", "FL_REASON_CHANGED", "FL_REASON_GOT_FOCUS", "FL_REASON_LOST_FOCUS", "FL_REASON_RELEASED", "FL_REASON_ENTER_KEY", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "FL_REASON_USER", "FL_REASON_USER+1", "FL_REASON_USER+2", "FL_REASON_USER+3", }; /** @} */ #endif /* FL_NAMES_H */ ================================================ FILE: Game Trainers/common/include/FL/platform.H ================================================ // // Platform header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // These are FLTK symbols that are necessary or useful for calling // platform specific functions. This file #include's certain platform // specific system header files that are necessary to declare platform // specific FLTK functions, for instance "Windows.h" under Windows. // You should include this file if (and ONLY if) you need to call // platform specific functions directly. // See FLTK documentation: chapter "Operating System Issues" on when // you need to #include #if !defined(FL_PLATFORM_H) && !defined(FL_DOXYGEN) # define FL_PLATFORM_H # include # include // will bring in FL/fl_config.h # include // for uchar class Fl_Window; # ifdef _WIN32 # include "win32.H" # elif defined(FLTK_USE_WAYLAND) # include "wayland.H" # elif defined(FLTK_USE_X11) # include "x11.H" # elif defined(__APPLE__) # include "mac.H" # endif // _WIN32 // // cross-platform declarations // #if defined(FL_LIBRARY) || defined(FL_INTERNALS) # include class FL_EXPORT Fl_X { public: fl_uintptr_t xid; Fl_Window* w; Fl_Region region; Fl_X *next; // static variables, static functions and member functions static Fl_X* first; static Fl_X* flx(const Fl_Window* w) {return w ? (Fl_X*)w->flx_ : 0;} # if defined(FLTK_USE_X11) && FLTK_USE_X11 // for backward compatibility static void make_xid(Fl_Window*, XVisualInfo* =fl_visual, Colormap=fl_colormap); static Fl_X* set_xid(Fl_Window*, Window); static inline Fl_X* i(const Fl_Window* w) {return flx(w);} # endif }; inline Window fl_xid(const Fl_Window* w) { Fl_X *xTemp = Fl_X::flx(w); return xTemp ? (Window)xTemp->xid : 0; } #else extern FL_EXPORT Window fl_xid_(const Fl_Window* w); # define fl_xid(w) fl_xid_(w) #endif // FL_LIBRARY || FL_INTERNALS extern FL_EXPORT Fl_Window* fl_find(Window xid); extern FL_EXPORT void fl_open_display(); extern FL_EXPORT void fl_close_display(); extern FL_EXPORT Window fl_window; extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b); extern FL_EXPORT void fl_open_callback(void (*)(const char *)); #endif // !FL_PLATFORM_H ================================================ FILE: Game Trainers/common/include/FL/platform_types.h ================================================ /* * Copyright 2016-2023 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this * file is missing or damaged, see the license at: * * https://www.fltk.org/COPYING.php * * Please see the following page on how to report bugs and issues: * * https://www.fltk.org/bugs.php */ #ifndef Fl_Platform_Types_H #define Fl_Platform_Types_H /** \file Definitions of platform-dependent types. The exact nature of these types varies with the platform. Therefore, portable FLTK applications should not assume these types have a specific size, or that they are pointers. */ #ifdef FL_DOXYGEN /** An integral type large enough to store a pointer or a long value. A pointer value can be safely cast to fl_intptr_t, and later cast back to its initial pointer type without change to the pointer value. A variable of type fl_intptr_t can also store a long int value. */ typedef opaque fl_intptr_t; /** An unsigned integral type large enough to store a pointer or an unsigned long value. A pointer value can be safely cast to fl_uintptr_t, and later cast back to its initial pointer type without change to the pointer value. A variable of type fl_uintptr_t can also store an unsigned long int value. */ typedef opaque fl_uintptr_t; /** Platform-specific value representing an offscreen drawing buffer. \note This value can be safely cast to these types on each platform: \li X11: Pixmap \li Wayland: cairo_t * \li Windows: HBITMAP \li macOS: CGContextRef */ typedef opaque Fl_Offscreen; /** Pointer to a platform-specific structure representing a collection of rectangles. \note This pointer can be safely cast to these types on each platform: \li X11: Region as defined by X11 \li Wayland: cairo_region_t * \li Windows: HRGN \li macOS: struct flCocoaRegion * */ typedef struct opaque *Fl_Region; typedef opaque FL_SOCKET; /**< socket or file descriptor */ /** Pointer to a platform-specific structure representing the window's OpenGL rendering context. \note This pointer can be safely cast to these types on each platform: \li X11: GLXContext \li Wayland: EGLContext \li Windows: HGLRC \li macOS: NSOpenGLContext * */ typedef struct opaque *GLContext; /** Platform-specific point in time, used for delta time calculation. \note This type may be a struct. sizeof(Fl_Timestamp) may be different on different platforms. Fl_Timestamp may change with future ABI changes. */ typedef opaque Fl_Timestamp; # define FL_COMMAND opaque /**< An alias for FL_CTRL on Windows and X11, or FL_META on MacOS X */ # define FL_CONTROL opaque /**< An alias for FL_META on Windows and X11, or FL_CTRL on MacOS X */ #else /* FL_DOXYGEN */ #ifndef FL_PLATFORM_TYPES_H #define FL_PLATFORM_TYPES_H #include #include // for time_t /* Platform-dependent types are defined here. These types must be defined by any platform: FL_SOCKET, struct dirent, fl_intptr_t, fl_uintptr_t NOTE: *FIXME* AlbrechtS 13 Apr 2016 (concerning FL_SOCKET) ---------------------------------------------------------- The Fl::add_fd() API is partially inconsistent because some of the methods explicitly use 'int', but the callback typedefs use FL_SOCKET. With the definition of FL_SOCKET below we can have different data sizes and different signedness of socket numbers on *some* platforms. */ #ifdef _WIN64 #if defined(_MSC_VER) && (_MSC_VER < 1600) # include /* stdint.h not available before VS 2010 (1600) */ #else # include #endif typedef intptr_t fl_intptr_t; typedef uintptr_t fl_uintptr_t; #else /* ! _WIN64 */ typedef long fl_intptr_t; typedef unsigned long fl_uintptr_t; #endif /* _WIN64 */ typedef void *GLContext; typedef void *Fl_Region; typedef fl_uintptr_t Fl_Offscreen; /* Allows all hybrid combinations except WIN32 + X11 with MSVC */ #if defined(_WIN32) && !defined(__MINGW32__) struct dirent {char d_name[1];}; #else # include #endif # if defined(_WIN64) && defined(_MSC_VER) typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET (see above) */ # else typedef int FL_SOCKET; # endif #include extern FL_EXPORT int fl_command_modifier(); extern FL_EXPORT int fl_control_modifier(); # define FL_COMMAND fl_command_modifier() # define FL_CONTROL fl_control_modifier() #endif /* FL_PLATFORM_TYPES_H */ /* This is currently the same for all platforms but may change in the future */ struct Fl_Timestamp_t { time_t sec; int usec; }; typedef struct Fl_Timestamp_t Fl_Timestamp; #endif /* FL_DOXYGEN */ #endif /* Fl_Platform_Types_H */ ================================================ FILE: Game Trainers/common/include/FL/wayland.H ================================================ // // Wayland/X11 hybrid platform header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // #if !defined(FL_PLATFORM_H) # error "Never use directly; include instead." #endif // !FL_PLATFORM_H /** \file \anchor wayland_H Definitions of functions specific to the Wayland platform. */ // *********** for Wayland component *********** typedef struct _cairo cairo_t; /** Returns the Wayland display in use */ extern FL_EXPORT struct wl_display *fl_wl_display(); /** Returns the wl_surface associated to a shown window */ extern FL_EXPORT struct wl_surface *fl_wl_surface(struct wld_window *xid); /** Returns a platform-specific reference associated to a shown window */ extern FL_EXPORT struct wld_window *fl_wl_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to a given the platform-specific window reference */ extern FL_EXPORT Fl_Window *fl_wl_find(struct wld_window *); /** Returns the cairo context associated to the current window or Fl_Image_Surface */ extern FL_EXPORT cairo_t *fl_wl_gc(); /** Returns the wl_compositor of the current Wayland session. This allows, for example, to create a wl_surface with \code struct wl_surface *my_wl_surface = wl_compositor_create_surface(fl_wl_compositor()); \endcode */ extern FL_EXPORT struct wl_compositor *fl_wl_compositor(); /** Returns the current buffer scaling factor for \p window. */ extern FL_EXPORT int fl_wl_buffer_scale(Fl_Window *window); typedef void *EGLContext; /** Returns the EGLContext corresponding to the given GLContext */ extern FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc); #ifndef FL_DOXYGEN # ifdef FLTK_USE_X11 // *********** for X11 component *********** # include "x11.H" # else typedef struct wld_window *Window; # endif #endif // FL_DOXYGEN ================================================ FILE: Game Trainers/common/include/FL/win32.H ================================================ // // Windows platform header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Do not directly include this file, instead use . It will // include this file if _WIN32 is defined. This is to encourage // portability of even the system-specific code... #ifdef FL_DOXYGEN /** \file Definitions of functions specific to the Windows platform. */ /** Returns the Windows-specific window reference corresponding to the given Fl_Window object */ extern HWND fl_win32_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to the given Windows-specific window reference */ extern Fl_Window *fl_win32_find(HWND); /** Returns the Windows-specific GL rendering context corresponding to the given GLContext */ extern HGLRC fl_win32_glcontext(GLContext rc); /** Returns the Windows-specific graphics context for the current window */ extern HDC fl_win32_gc(); /** Returns the Windows-specific display in use */ extern HINSTANCE fl_win32_display(); #else #ifndef FL_PLATFORM_H # error "Never use directly; include instead." #endif // !FL_PLATFORM_H #include typedef HWND Window; typedef struct HGLRC__ *HGLRC; extern FL_EXPORT HGLRC fl_win32_glcontext(GLContext rc); extern FL_EXPORT HWND fl_win32_xid(const Fl_Window *win); extern FL_EXPORT Fl_Window *fl_win32_find(HWND); // this part is included only when compiling the FLTK library or if requested explicitly #if defined(FL_LIBRARY) || defined(FL_INTERNALS) // In some of the distributions, the gcc header files are missing some stuff: #ifndef LPMINMAXINFO #define LPMINMAXINFO MINMAXINFO* #endif #ifndef VK_LWIN #define VK_LWIN 0x5B #define VK_RWIN 0x5C #define VK_APPS 0x5D #endif extern FL_EXPORT UINT fl_wake_msg; extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_xid() extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays! extern void fl_release_dc(HWND w, HDC dc); extern FL_EXPORT void fl_save_dc( HWND w, HDC dc); #endif // FL_LIBRARY || FL_INTERNALS // most recent fl_color() or fl_rgbcolor() points at one of these: extern FL_EXPORT struct Fl_XMap { COLORREF rgb; // this should be the type the RGB() macro returns HPEN pen; // pen, 0 if none created yet int brush; // ref to solid brush, 0 if none created yet int pwidth; // the width of the pen, if present } *fl_current_xmap; inline COLORREF fl_RGB() {return fl_current_xmap->rgb;} inline HPEN fl_pen() {return fl_current_xmap->pen;} FL_EXPORT HBRUSH fl_brush(); // allocates a brush if necessary FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work extern FL_EXPORT HINSTANCE fl_display; extern FL_EXPORT HINSTANCE fl_win32_display(); extern FL_EXPORT HDC fl_gc; extern FL_EXPORT HDC fl_win32_gc(); extern FL_EXPORT MSG fl_msg; extern FL_EXPORT HDC fl_GetDC(Window); extern FL_EXPORT HDC fl_makeDC(HBITMAP); #endif // FL_DOXYGEN ================================================ FILE: Game Trainers/common/include/FL/x.H ================================================ // // *Deprecated* platform header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // IMPORTANT: This file is deprecated since FLTK 1.4.0. DO NOT include it. // FL/x.H will be removed in a future FLTK release. // Please #include instead if you really need it. See // documentation in FL/platform.H to decide whether you need that file. #if !defined(Fl_X_H) && !defined(FL_DOXYGEN) # define Fl_X_H # include #endif // !Fl_X_H ================================================ FILE: Game Trainers/common/include/FL/x11.H ================================================ // // X11 platform header file for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // // https://www.fltk.org/COPYING.php // // Please see the following page on how to report bugs and issues: // // https://www.fltk.org/bugs.php // // Do not directly include this file, instead use . It will // include this file if FLTK_USE_X11 is defined. This is to encourage // portability of even the system-specific code... #ifdef FL_DOXYGEN /** \file Definitions of functions specific to the X11 platform. */ /** Returns the X11 Display in use */ extern Display *fl_x11_display(); /** Have FLTK use a pre-established X11 connection. This function must be called before FLTK attempts to open its own X11 connection, that is, as long as fl_x11_display() returns NULL. \param d the X11 Display* value representing a valid, pre-established X11 connection */ extern void fl_x11_use_display(Display *d); /** Returns the Window reference for the given Fl_Window, or zero if not \c shown(). */ extern Window fl_x11_xid(const Fl_Window *win); /** Returns the Fl_Window corresponding to the given Window reference. */ extern Fl_Window *fl_x11_find(Window xid); /** Returns the X11-specific currently active graphics context. */ extern GC fl_x11_gc(); /** Returns the Cairo-specific currently active graphics context (FLTK_GRAPHICS_CAIRO=On) */ extern cairo_t* fl_cairo_gc(); #else // ! FL_DOXYGEN #ifndef FL_PLATFORM_H # error "Never use directly; include instead." #endif // !FL_PLATFORM_H #include #if defined(_ABIN32) || defined(_ABI64) // fix for broken SGI Irix X .h files # pragma set woff 3322 #endif #include #include #if defined(_ABIN32) || defined(_ABI64) # pragma reset woff 3322 #endif #include typedef struct __GLXcontextRec *GLXContext; extern GLXContext fl_x11_glcontext(GLContext rc); // constant info about the X server connection: extern FL_EXPORT Display *fl_display; extern FL_EXPORT Display *fl_x11_display(); extern FL_EXPORT void fl_x11_use_display(Display *); extern FL_EXPORT Window fl_x11_xid(const Fl_Window *win); extern FL_EXPORT Fl_Window *fl_x11_find(Window); extern FL_EXPORT int fl_screen; extern FL_EXPORT XVisualInfo *fl_visual; extern FL_EXPORT Colormap fl_colormap; // drawing functions: extern FL_EXPORT GC fl_gc; #if FLTK_USE_CAIRO typedef struct _cairo cairo_t; extern FL_EXPORT cairo_t* fl_cairo_gc(); #endif extern FL_EXPORT GC fl_x11_gc(); FL_EXPORT ulong fl_xpixel(Fl_Color i); FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b); // feed events into fltk: FL_EXPORT int fl_handle(const XEvent&); // you can use these in Fl::add_handler() to look at events: extern FL_EXPORT const XEvent* fl_xevent; extern FL_EXPORT ulong fl_event_time; #if defined(FL_LIBRARY) || defined(FL_INTERNALS) extern FL_EXPORT Window fl_message_window; extern FL_EXPORT void *fl_xftfont; // access to core fonts: // This class provides a "smart pointer" that returns a pointer to an XFontStruct. // The global variable fl_xfont can be called wherever a bitmap "core" font is // needed, e.g. when rendering to a GL context under X11. // With Xlib / X11 fonts, fl_xfont will return the current selected font. // With XFT / X11 fonts, fl_xfont will attempt to return the bitmap "core" font most // similar to (usually the same as) the current XFT font. class FL_EXPORT Fl_XFont_On_Demand { public: Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { } Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x) { ptr = x.ptr; return *this; } Fl_XFont_On_Demand& operator=(XFontStruct* p) { ptr = p; return *this; } XFontStruct* value(); operator XFontStruct*() { return value(); } XFontStruct& operator*() { return *value(); } XFontStruct* operator->() { return value(); } bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; } bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; } private: XFontStruct *ptr; }; extern FL_EXPORT Fl_XFont_On_Demand fl_xfont; extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid() #endif // FL_LIBRARY || FL_INTERNALS #endif // FL_DOXYGEN ================================================ FILE: Game Trainers/common/include/FLTKUtils.h ================================================ #include #include #include #include using json = nlohmann::json; // Globals constexpr int font_size = 15; static HANDLE font_handle = nullptr; std::unordered_map> translations; std::vector> translatable_widgets; std::string language = "en_US"; std::string settings_path = ""; // UI Layout Constants constexpr int UI_LEFT_MARGIN = 20; constexpr int UI_BUTTON_WIDTH = 50; constexpr int UI_TOGGLE_WIDTH = 16; constexpr int UI_TOGGLE_SPACER_WIDTH = 24; constexpr int UI_INPUT_WIDTH = 200; constexpr int UI_OPTION_GAP = 10; constexpr int UI_OPTION_HEIGHT = static_cast(font_size * 1.5); // =========================================================================== // Data Structures // =========================================================================== struct TimeoutData { Trainer *trainer; Fl_Box *process_exe; Fl_Box *process_id; }; struct ChangeLanguageData { std::string lang; Fl_Group *group; }; // Structure to hold callback data for Apply button struct ApplyData { Trainer *trainer; std::string optionName; Fl_Button *button; Fl_Input *input; }; // Structure to hold callback data for toggles struct ToggleData { Trainer *trainer; std::string optionName; Fl_Check_Button *button; Fl_Input *input; }; // Structure to hold a widget pair (button and input) struct WidgetPair { Fl_Widget *button; // Fl_Check_Button* or Fl_Button* Fl_Input *input; // nullptr if input not created }; // Structure to hold callback data for info buttons struct InfoCallbackData { Trainer *trainer; Fl_Input **input_ptr; std::string windowTitleKey; Fl_Window **windowInstance; std::vector columnTitles; std::string (Trainer::*dataRetriever)(); }; // =========================================================================== // Resource Management Functions // =========================================================================== const unsigned char *load_resource(const char *resource_name, DWORD &size) { HRSRC hRes = FindResourceA(nullptr, resource_name, MAKEINTRESOURCEA(10)); if (!hRes) { size = 0; return nullptr; } HGLOBAL hData = LoadResource(nullptr, hRes); if (!hData) { size = 0; return nullptr; } size = SizeofResource(nullptr, hRes); if (size == 0) { std::cerr << "Error: Failed to load resource: " << resource_name << std::endl; return nullptr; } return static_cast(LockResource(hData)); } void load_translations(const char *resource_name) { DWORD size = 0; const unsigned char *data = load_resource(resource_name, size); json j = json::parse(std::string(reinterpret_cast(data), size)); for (auto &lang : j.items()) { std::string lang_code = lang.key(); for (auto &text : lang.value().items()) { translations[lang_code][text.key()] = text.value(); } } } void saveSettings() { json settings; if (std::filesystem::exists(settings_path)) { std::ifstream file(settings_path); file >> settings; file.close(); } else { std::filesystem::create_directories(std::filesystem::path(settings_path).parent_path()); } settings["language"] = language; std::ofstream file(settings_path); file << settings.dump(4); file.close(); } void getSettingsPath() { PWSTR path = nullptr; SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, nullptr, &path); std::filesystem::path app_data_path(path); std::filesystem::path full_path = app_data_path / "GCM Settings" / "trainers.json"; settings_path = full_path.string(); CoTaskMemFree(path); } void setupLanguage() { getSettingsPath(); if (std::filesystem::exists(settings_path)) { std::ifstream file(settings_path); json settings; file >> settings; file.close(); if (settings.contains("language")) { language = settings["language"].get(); return; } } // If the file doesn't exist or "language" entry is missing, detect system locale wchar_t locale_name[LOCALE_NAME_MAX_LENGTH]; if (GetUserDefaultLocaleName(locale_name, LOCALE_NAME_MAX_LENGTH) > 0) { int size_needed = WideCharToMultiByte(CP_UTF8, 0, locale_name, -1, nullptr, 0, nullptr, nullptr); if (size_needed > 0) { std::string detected_locale(size_needed - 1, 0); WideCharToMultiByte(CP_UTF8, 0, locale_name, -1, &detected_locale[0], size_needed, nullptr, nullptr); std::cout << "Detected locale: " << detected_locale << std::endl; if (detected_locale == "zh-CN" || detected_locale == "zh-Hans-HK" || detected_locale == "zh-Hans-MO" || detected_locale == "zh-SG") { language = "zh_CN"; } else if (detected_locale == "zh-HK" || detected_locale == "zh-MO" || detected_locale == "zh-TW") { language = "zh_CN"; } else if (detected_locale == "en-US") { language = "en_US"; } } } saveSettings(); } void change_language(const std::string &lang, Fl_Group *group) { group->hide(); for (const auto &[child, key] : translatable_widgets) { auto lang_translations = translations.find(lang); if (lang_translations != translations.end()) { auto label_it = lang_translations->second.find(key); if (label_it != lang_translations->second.end()) { if (child->tooltip()) { child->tooltip(label_it->second.c_str()); continue; } // Update the label with the translated text child->copy_label(label_it->second.c_str()); child->labelsize(font_size); child->labelfont(FL_FREE_FONT); child->labelcolor(FL_WHITE); Fl_Button *button = dynamic_cast(child); if (button) { button->labelcolor(FL_BLACK); continue; } Fl_Flex *parent_flex = dynamic_cast(child->parent()); if (parent_flex) { parent_flex->fixed(child, fl_width(child->label())); } } } } group->redraw(); group->show(); language = lang; saveSettings(); } void change_language_callback(Fl_Widget *widget, void *data) { ChangeLanguageData *changeLanguageData = static_cast(data); std::string lang = changeLanguageData->lang; Fl_Group *group = changeLanguageData->group; change_language(lang, group); } // Assign translation key for translating widget's label void tr(Fl_Widget *widget, const std::string &key) { translatable_widgets.emplace_back(widget, key); } // Directly translate a string using the current language const char *t(const std::string &key) { auto lang_it = translations.find(language); if (lang_it != translations.end()) { auto trans_it = lang_it->second.find(key); if (trans_it != lang_it->second.end()) { return trans_it->second.c_str(); } } return key.c_str(); } void uncheck_all_checkbuttons(Fl_Group *group) { if (!group) return; for (int i = 0; i < group->children(); ++i) { Fl_Widget *child = group->child(i); if (!child) continue; Fl_Check_Button *check_btn = dynamic_cast(child); Fl_Input *input = dynamic_cast(child); if (check_btn) { check_btn->value(0); } if (input) { input->readonly(0); } // If the child is a group, recurse into it Fl_Group *subgroup = dynamic_cast(child); if (subgroup) { uncheck_all_checkbuttons(subgroup); } } } void clean_up(Fl_Window *window, Trainer *trainer) { trainer->cleanUp(); uncheck_all_checkbuttons(window); } bool compareNumericStrings(const std::string &a, const std::string &b) { // Handle negative numbers if (a[0] == '-' && b[0] != '-') return true; // Negative is less than positive if (a[0] != '-' && b[0] == '-') return false; // Positive is greater than negative if (a[0] == '-' && b[0] == '-') return compareNumericStrings(b.substr(1), a.substr(1)); // Reverse comparison for negatives // Remove leading zeros std::string a_trim = a; std::string b_trim = b; a_trim.erase(0, a_trim.find_first_not_of('0')); b_trim.erase(0, b_trim.find_first_not_of('0')); // Compare by length if (a_trim.size() != b_trim.size()) return a_trim.size() < b_trim.size(); // Compare lexicographically if lengths are equal return a_trim < b_trim; } void set_input_values(Fl_Input *input, std::string def, std::string min, std::string max) { input->value(def.c_str()); // A callback function to handle input changes auto input_callback = [](Fl_Widget *widget, void *data) { Fl_Input *input = dynamic_cast(widget); if (!input) return; std::string value = input->value(); auto constraints = static_cast *>(data); std::string def = std::get<0>(*constraints); std::string min = std::get<1>(*constraints); std::string max = std::get<2>(*constraints); if (value.empty()) { input->value(def.c_str()); } else if (compareNumericStrings(value, min)) { input->value(min.c_str()); } else if (compareNumericStrings(max, value)) { input->value(max.c_str()); } }; // Associate the callback with the input field and pass the min/max data auto *constraints = new std::tuple(def, min, max); input->callback(input_callback, (void *)constraints); } // Function to periodically check process status and update GUI void check_process_status(void *data) { TimeoutData *timeoutData = static_cast(data); Trainer *trainer = timeoutData->trainer; Fl_Box *process_exe = timeoutData->process_exe; Fl_Box *process_id = timeoutData->process_id; bool running = trainer->isProcessRunning(); // Retrieve process information std::wstring processExeW = trainer->getProcessName(); std::string processExeStr; if (!processExeW.empty()) { int size_needed = WideCharToMultiByte(CP_UTF8, 0, processExeW.c_str(), -1, nullptr, 0, nullptr, nullptr); if (size_needed > 0) { processExeStr.resize(size_needed - 1); WideCharToMultiByte(CP_UTF8, 0, processExeW.c_str(), -1, &processExeStr[0], size_needed, nullptr, nullptr); } } DWORD processId = trainer->getProcessId(); std::string processIdStr = processId ? std::to_string(processId) : "N/A"; // Set label color based on process status process_exe->copy_label(processExeStr.c_str()); process_exe->labelcolor(running ? FL_DARK_GREEN : FL_RED); process_exe->labelsize(font_size); process_id->copy_label(processIdStr.c_str()); process_id->labelcolor(FL_WHITE); process_id->labelsize(font_size); if (!running) { clean_up(process_exe->window(), trainer); } Fl::repeat_timeout(1.0, check_process_status, data); } // =========================================================================== // Info Table and Callbacks // =========================================================================== // Displayed by pressing info button class ItemTable : public Fl_Table { private: std::vector> items; int selected_row = -1; Fl_Input *input; std::vector columnTitles; protected: void draw_cell(TableContext context, int row, int col, int x, int y, int w, int h) override { switch (context) { case CONTEXT_STARTPAGE: fl_font(FL_FREE_FONT, font_size); return; case CONTEXT_COL_HEADER: fl_push_clip(x, y, w, h); fl_color(FL_FREE_COLOR); fl_rectf(x, y, w, h); fl_color(FL_WHITE); if (col >= 0 && col < (int)columnTitles.size()) { fl_draw(t(columnTitles[col]), x + 4, y, w, h, FL_ALIGN_LEFT); } fl_pop_clip(); return; case CONTEXT_CELL: fl_push_clip(x, y, w, h); fl_color(row == selected_row ? fl_lighter(FL_FREE_COLOR) : FL_FREE_COLOR); fl_rectf(x, y, w, h); fl_color(FL_WHITE); if (row < (int)items.size() && col < (int)items[row].size()) { fl_draw(items[row][col].c_str(), x + 4, y, w, h, FL_ALIGN_LEFT); } fl_pop_clip(); return; default: return; } } bool find_cell_at(int mouse_x, int mouse_y, int &row, int &col) { int table_x = x(); int table_y = y(); int table_w = w() - scrollbar_size(); int table_h = h() - scrollbar_size(); int mx = mouse_x - table_x; int my = mouse_y - table_y; int scroll_y = vscrollbar->value(); int adjusted_my = my + scroll_y; if (mx < 0 || mx >= table_w) return false; int y_offset = col_header_height(); row = -1; for (int r = 0; r < rows(); r++) { int rh = row_height(r); if (adjusted_my >= y_offset && adjusted_my < y_offset + rh) { row = r; break; } y_offset += rh; } if (row < 0 || row >= (int)items.size()) return false; int x_offset = 0; col = -1; for (int c = 0; c < cols(); c++) { int cw = col_width(c); if (mx >= x_offset && mx < x_offset + cw) { col = c; break; } x_offset += cw; } if (col < 0 || col >= cols()) return false; return true; } int handle(int event) override { int ret = Fl_Table::handle(event); int row, col; if (event == FL_PUSH && Fl::event_button() == FL_LEFT_MOUSE) { if (find_cell_at(Fl::event_x(), Fl::event_y(), row, col)) { selected_row = row; if (input && row < (int)items.size() && !items[row].empty()) { input->value(items[row][0].c_str()); } redraw(); return 1; } else { selected_row = -1; redraw(); return 1; } } else if (event == FL_RELEASE && Fl::event_button() == FL_LEFT_MOUSE && Fl::event_clicks() > 0) { if (find_cell_at(Fl::event_x(), Fl::event_y(), row, col)) { selected_row = row; if (input && row < (int)items.size() && !items[row].empty()) { input->value(items[row][0].c_str()); } Fl_Window *win = dynamic_cast(parent()->top_window()); if (win) { win->hide(); } redraw(); return 1; } } return ret; } public: ItemTable(int x, int y, int w, int h, Fl_Input *inp, const std::vector &titles, const char *l = 0) : Fl_Table(x, y, w, h, l), input(inp), columnTitles(titles) { int scrollbarSize = 16; int numCols = titles.size(); cols(numCols); col_header(1); // Set column widths: first column (ID) is narrower, remaining columns share the rest int availableWidth = w - scrollbarSize; int idColWidth = 100; int otherColsWidth = (availableWidth - idColWidth) / (numCols - 1); col_width(0, idColWidth); for (int i = 1; i < numCols; i++) { col_width(i, otherColsWidth); } row_header(0); box(FL_NO_BOX); scrollbar_size(scrollbarSize); end(); } void setItems(const std::vector> &item_list) { items = item_list; rows(item_list.size()); selected_row = -1; redraw(); } }; void toggle_callback(Fl_Widget *widget, void *data); void apply_callback(Fl_Widget *widget, void *data); void info_callback(Fl_Widget *widget, void *data) { InfoCallbackData *info_data = static_cast(data); if (!info_data || !info_data->trainer || info_data->columnTitles.empty() || !info_data->windowInstance) return; Trainer *trainer = info_data->trainer; Fl_Input *input = info_data->input_ptr ? *info_data->input_ptr : nullptr; const std::vector &columnTitles = info_data->columnTitles; const std::string &windowTitleKey = info_data->windowTitleKey; Fl_Window *&list_window = *info_data->windowInstance; if (!trainer->isProcessRunning()) { fl_alert(t("Please run the game first.")); return; } // Call the member function pointer to get the list data std::string itemListData = (trainer->*info_data->dataRetriever)(); if (list_window && list_window->shown()) { list_window->show(); return; } Fl_Window *trainer_window = widget->window(); int trainer_x = trainer_window->x(); int trainer_y = trainer_window->y(); int trainer_w = trainer_window->w(); int trainer_h = trainer_window->h(); int list_w = 350; int list_h = 500; int list_x = trainer_x + (trainer_w - list_w) / 2; int list_y = trainer_y + (trainer_h - list_h) / 2; list_window = new Fl_Window(list_x, list_y, list_w, list_h, t(windowTitleKey.c_str())); list_window->icon((char *)LoadIconA(GetModuleHandle(NULL), "APP_ICON")); std::vector> items; int numCols = columnTitles.size(); std::istringstream iss(itemListData); std::string line; while (std::getline(iss, line)) { line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); // Parse columns separated by '>' std::vector rowData; std::istringstream lineStream(line); std::string column; while (std::getline(lineStream, column, '>')) { const char *translatedText = t(column); std::string displayText = (translatedText && *translatedText) ? std::string(translatedText) : column; rowData.push_back(displayText); } if ((int)rowData.size() >= numCols) { rowData.resize(numCols); items.push_back(rowData); } } ItemTable *table = new ItemTable(0, 0, list_w, list_h, input, columnTitles); table->setItems(items); table->color(FL_FREE_COLOR); list_window->end(); list_window->show(); } // =========================================================================== // Widget Placement Helper Functions // =========================================================================== Fl_Button *create_info_button( Trainer *trainer, Fl_Input **input_field_ptr, const std::vector &info_columns, const std::string &info_window_key, Fl_Window **info_window_instance, std::string (Trainer::*info_data_retriever)(), Fl_PNG_Image *info_img) { Fl_Button *info_button = new Fl_Button(0, 0, 0, 0); info_button->box(FL_NO_BOX); info_button->image(info_img); InfoCallbackData *info_data = new InfoCallbackData{trainer, input_field_ptr, info_window_key, info_window_instance, info_columns, info_data_retriever}; info_button->callback(info_callback, info_data); return info_button; } Fl_Box *create_info_hover( std::string info_text, Fl_PNG_Image *info_img) { Fl_Box *info_hover = new Fl_Box(0, 0, 0, 0); info_hover->box(FL_NO_BOX); info_hover->image(info_img); info_hover->tooltip(info_text.c_str()); tr(info_hover, info_text); return info_hover; } Fl_Check_Button *place_toggle_widget( Fl_Flex *parent_flex, Trainer *trainer, const std::string &optionName, const std::string &labelKey, Fl_Input **out_input = nullptr, const char *input_default = nullptr, const char *input_min = nullptr, const char *input_max = nullptr, int input_type = FL_INT_INPUT, Fl_Widget *info_button = nullptr) { Fl_Flex *toggle_flex = new Fl_Flex(0, 0, 0, 0, Fl_Flex::HORIZONTAL); toggle_flex->gap(UI_OPTION_GAP); Fl_Box *toggle_spacer = new Fl_Box(0, 0, 0, 0); toggle_flex->fixed(toggle_spacer, UI_TOGGLE_SPACER_WIDTH); Fl_Check_Button *check_button = new Fl_Check_Button(0, 0, 0, 0); toggle_flex->fixed(check_button, UI_TOGGLE_WIDTH); Fl_Box *label = new Fl_Box(0, 0, 0, 0); tr(label, labelKey); Fl_Input *input = nullptr; if (input_default && input_min && input_max) { input = new Fl_Input(0, 0, 0, 0); toggle_flex->fixed(input, UI_INPUT_WIDTH); input->type(input_type); set_input_values(input, input_default, input_min, input_max); if (out_input) *out_input = input; } // Optional info button if (info_button) { toggle_flex->fixed(info_button, 20); toggle_flex->add(info_button); } ToggleData *toggle_data = new ToggleData{trainer, optionName, check_button, input}; check_button->callback(toggle_callback, toggle_data); toggle_flex->end(); parent_flex->fixed(toggle_flex, UI_OPTION_HEIGHT); return check_button; } Fl_Button *place_apply_widget( Fl_Flex *parent_flex, Trainer *trainer, const std::string &optionName, const std::string &labelKey, Fl_Input **out_input = nullptr, const char *input_default = nullptr, const char *input_min = nullptr, const char *input_max = nullptr, int input_type = FL_INT_INPUT, Fl_Widget *info_button = nullptr) { Fl_Flex *apply_flex = new Fl_Flex(0, 0, 0, 0, Fl_Flex::HORIZONTAL); apply_flex->gap(UI_OPTION_GAP); Fl_Button *apply_button = new Fl_Button(0, 0, 0, 0); apply_flex->fixed(apply_button, UI_BUTTON_WIDTH); tr(apply_button, "Apply"); Fl_Box *label = new Fl_Box(0, 0, 0, 0); tr(label, labelKey); Fl_Input *input = nullptr; if (input_default && input_min && input_max) { input = new Fl_Input(0, 0, 0, 0); apply_flex->fixed(input, UI_INPUT_WIDTH); input->type(input_type); set_input_values(input, input_default, input_min, input_max); if (out_input) *out_input = input; } // Optional info button if (info_button) { apply_flex->fixed(info_button, 20); apply_flex->add(info_button); } ApplyData *apply_data = new ApplyData{trainer, optionName, apply_button, input}; apply_button->callback(apply_callback, apply_data); apply_flex->end(); parent_flex->fixed(apply_flex, UI_OPTION_HEIGHT); return apply_button; } WidgetPair place_indented_toggle_widget( Fl_Flex *parent_flex, const std::string &labelKey, const char *input_default = nullptr, const char *input_min = nullptr, const char *input_max = nullptr, int input_type = FL_INT_INPUT) { Fl_Flex *toggle_flex = new Fl_Flex(0, 0, 0, 0, Fl_Flex::HORIZONTAL); toggle_flex->gap(UI_OPTION_GAP); Fl_Box *indent_spacer = new Fl_Box(0, 0, 0, 0); toggle_flex->fixed(indent_spacer, UI_BUTTON_WIDTH); Fl_Box *toggle_spacer = new Fl_Box(0, 0, 0, 0); toggle_flex->fixed(toggle_spacer, UI_TOGGLE_SPACER_WIDTH); Fl_Check_Button *check_button = new Fl_Check_Button(0, 0, 0, 0); toggle_flex->fixed(check_button, UI_TOGGLE_WIDTH); Fl_Box *label = new Fl_Box(0, 0, 0, 0); tr(label, labelKey); Fl_Input *input = nullptr; if (input_default && input_min && input_max) { input = new Fl_Input(0, 0, 0, 0); toggle_flex->fixed(input, UI_INPUT_WIDTH); input->type(input_type); set_input_values(input, input_default, input_min, input_max); } toggle_flex->end(); parent_flex->fixed(toggle_flex, UI_OPTION_HEIGHT); return WidgetPair{check_button, input}; } WidgetPair place_indented_apply_widget( Fl_Flex *parent_flex, const std::string &labelKey, const char *input_default = nullptr, const char *input_min = nullptr, const char *input_max = nullptr, int input_type = FL_INT_INPUT) { Fl_Flex *apply_flex = new Fl_Flex(0, 0, 0, 0, Fl_Flex::HORIZONTAL); apply_flex->gap(UI_OPTION_GAP); Fl_Box *indent_spacer = new Fl_Box(0, 0, 0, 0); apply_flex->fixed(indent_spacer, UI_BUTTON_WIDTH); Fl_Button *apply_button = new Fl_Button(0, 0, 0, 0); apply_flex->fixed(apply_button, UI_BUTTON_WIDTH); tr(apply_button, "Apply"); Fl_Box *label = new Fl_Box(0, 0, 0, 0); tr(label, labelKey); Fl_Input *input = nullptr; if (input_default && input_min && input_max) { input = new Fl_Input(0, 0, 0, 0); apply_flex->fixed(input, UI_INPUT_WIDTH); input->type(input_type); set_input_values(input, input_default, input_min, input_max); } apply_flex->end(); parent_flex->fixed(apply_flex, UI_OPTION_HEIGHT); return WidgetPair{apply_button, input}; } Fl_Input *place_indented_input_widget( Fl_Flex *parent_flex, const std::string &labelKey, const char *input_default, const char *input_min, const char *input_max, int input_type = FL_INT_INPUT) { Fl_Flex *input_flex = new Fl_Flex(0, 0, 0, 0, Fl_Flex::HORIZONTAL); input_flex->gap(UI_OPTION_GAP); Fl_Box *indent_spacer = new Fl_Box(0, 0, 0, 0); input_flex->fixed(indent_spacer, UI_BUTTON_WIDTH); Fl_Input *input = new Fl_Input(0, 0, 0, 0); input_flex->fixed(input, UI_BUTTON_WIDTH); input->type(input_type); set_input_values(input, input_default, input_min, input_max); Fl_Box *label = new Fl_Box(0, 0, 0, 0); tr(label, labelKey); input_flex->end(); parent_flex->fixed(input_flex, UI_OPTION_HEIGHT); return input; } ================================================ FILE: Game Trainers/common/include/Il2CppBase.h ================================================ #pragma once #include "TrainerBase.h" #include class Il2CppBase : public TrainerBase { public: HMODULE hInjectedDll = NULL; void *remoteArgMemory = nullptr; std::string injectedDllPath; uintptr_t remoteModuleBase = 0; uintptr_t localModuleBase = 0; // Response communication with injected DLL HANDLE hResponseMapFile = NULL; LPVOID responseBuffer = nullptr; HANDLE hResponseEvent = NULL; const size_t responseBufferSize = 1024 * 1024; const char *DLL_RESOURCE_NAME = "IL2CPP_DLL"; Il2CppBase(const std::wstring &processIdentifier, bool useWindowTitle = false) : TrainerBase(processIdentifier, useWindowTitle) { } virtual ~Il2CppBase() { unloadDll(); } // Extract DLL from resources to a temp file with unique name per trainer std::string extractDllFromResource() { HMODULE hModule = GetModuleHandle(nullptr); HRSRC hResource = FindResourceA(hModule, DLL_RESOURCE_NAME, MAKEINTRESOURCEA(10)); if (!hResource) { std::cerr << "[!] Failed to find resource: " << DLL_RESOURCE_NAME << "\n"; return ""; } HGLOBAL hData = LoadResource(hModule, hResource); if (!hData) { std::cerr << "[!] Failed to load resource: " << DLL_RESOURCE_NAME << "\n"; return ""; } LPVOID pData = LockResource(hData); if (!pData) { std::cerr << "[!] Failed to lock resource: " << DLL_RESOURCE_NAME << "\n"; return ""; } DWORD dwSize = SizeofResource(hModule, hResource); char tempPath[MAX_PATH]; GetTempPathA(MAX_PATH, tempPath); char dllPath[MAX_PATH]; strcpy_s(dllPath, MAX_PATH, tempPath); // Create unique filename with current process ID to avoid conflicts between trainer instances char uniqueName[64]; snprintf(uniqueName, sizeof(uniqueName), "IL2CPP_%lu.dll", GetCurrentProcessId()); strcat_s(dllPath, MAX_PATH, uniqueName); HANDLE hFile = CreateFileA(dllPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { std::cerr << "[!] Failed to create DLL file: " << dllPath << "\n"; return ""; } DWORD bytesWritten; WriteFile(hFile, pData, dwSize, &bytesWritten, nullptr); CloseHandle(hFile); if (bytesWritten != dwSize) { std::cerr << "[!] Failed to write DLL resource to file.\n"; DeleteFileA(dllPath); return ""; } std::cout << "[+] DLL extracted to: " << dllPath << std::endl; return std::string(dllPath); } /** Injects the DLL into the target process and retrieves its base address */ bool initializeDllInjection() { if (hInjectedDll != NULL) return true; // 1. Extract DLL to temp location if (injectedDllPath.empty()) { injectedDllPath = extractDllFromResource(); if (injectedDllPath.empty()) { std::cerr << "[!] Failed to extract DLL from resources.\n"; return false; } } // 2. Allocate memory in target process for DLL path size_t pathLength = injectedDllPath.length() + 1; LPVOID pRemotePath = VirtualAllocEx(hProcess, nullptr, pathLength, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!pRemotePath) { std::cerr << "[!] Failed to allocate memory in target process.\n"; return false; } // 3. Write DLL path to remote memory if (!WriteProcessMemory(hProcess, pRemotePath, injectedDllPath.c_str(), pathLength, nullptr)) { std::cerr << "[!] Failed to write DLL path to target process.\n"; VirtualFreeEx(hProcess, pRemotePath, 0, MEM_RELEASE); return false; } // 4. Get LoadLibraryA address HMODULE kernel32 = GetModuleHandleA("kernel32.dll"); FARPROC loadLibraryA = GetProcAddress(kernel32, "LoadLibraryA"); if (!loadLibraryA) { std::cerr << "[!] Failed to get LoadLibraryA address.\n"; VirtualFreeEx(hProcess, pRemotePath, 0, MEM_RELEASE); return false; } // 5. Create remote thread to load DLL HANDLE hRemoteThread = CreateRemoteThread( hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)loadLibraryA, pRemotePath, 0, nullptr); if (!hRemoteThread) { std::cerr << "[!] Failed to create remote thread.\n"; VirtualFreeEx(hProcess, pRemotePath, 0, MEM_RELEASE); return false; } // 6. Wait for remote thread DWORD waitResult = WaitForSingleObject(hRemoteThread, 5000); if (waitResult == WAIT_TIMEOUT) { std::cerr << "[!] Remote thread timed out.\n"; TerminateThread(hRemoteThread, 0); CloseHandle(hRemoteThread); VirtualFreeEx(hProcess, pRemotePath, 0, MEM_RELEASE); return false; } // 7. Get module base from exit code DWORD exitCode = 0; GetExitCodeThread(hRemoteThread, &exitCode); remoteModuleBase = static_cast(exitCode); CloseHandle(hRemoteThread); VirtualFreeEx(hProcess, pRemotePath, 0, MEM_RELEASE); // For 64-bit processes, the exit code is truncated, so we need to find the actual module base // Use EnumProcessModules with a short timeout to find the injected DLL remoteModuleBase = 0; std::string dllName = injectedDllPath.substr(injectedDllPath.find_last_of("\\/") + 1); // Poll for module with timeout DWORD pollStart = GetTickCount(); const DWORD POLL_TIMEOUT = 2000; // 2 second timeout while (!remoteModuleBase && (GetTickCount() - pollStart) < POLL_TIMEOUT) { HMODULE modules[1024]; DWORD needed = 0; if (EnumProcessModules(hProcess, modules, sizeof(modules), &needed)) { int numModules = needed / sizeof(HMODULE); for (int i = 0; i < numModules; i++) { char modulePath[MAX_PATH]; if (GetModuleFileNameExA(hProcess, modules[i], modulePath, MAX_PATH)) { std::string modPath(modulePath); std::string modName = modPath.substr(modPath.find_last_of("\\/") + 1); if (modName == dllName) { remoteModuleBase = reinterpret_cast(modules[i]); break; } } } } if (!remoteModuleBase) Sleep(50); // Small delay before retry } if (!remoteModuleBase) { std::cerr << "[!] Failed to find injected DLL in target process.\n"; return false; } // 8. Load DLL locally for offset calculations HMODULE hLocalDll = LoadLibraryA(injectedDllPath.c_str()); if (!hLocalDll) { std::cerr << "[!] Failed to load DLL locally.\n"; return false; } localModuleBase = reinterpret_cast(hLocalDll); hInjectedDll = hLocalDll; std::cout << "[+] DLL injected successfully.\n"; std::cout << "[+] Remote base: 0x" << std::hex << remoteModuleBase << std::dec << "\n"; // 9. Initialize response communication channel if (!initializeResponseChannel()) { std::cerr << "[!] Failed to initialize response communication channel.\n"; return false; } return true; } /** Initialize shared memory and event for receiving responses from injected DLL */ bool initializeResponseChannel() { std::string responseSharedMemName = "IL2CppResponseSharedMemory_" + std::to_string(procId); hResponseMapFile = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, responseBufferSize, responseSharedMemName.c_str()); if (hResponseMapFile == NULL) { std::cerr << "[!] Failed to create response file mapping: " << GetLastError() << "\n"; return false; } responseBuffer = MapViewOfFile(hResponseMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (responseBuffer == NULL) { std::cerr << "[!] Failed to map response buffer: " << GetLastError() << "\n"; CloseHandle(hResponseMapFile); hResponseMapFile = NULL; return false; } std::string eventName = "IL2CppResponseEvent_" + std::to_string(procId); hResponseEvent = CreateEventA(NULL, FALSE, FALSE, eventName.c_str()); if (hResponseEvent == NULL) { std::cerr << "[!] Failed to create response event: " << GetLastError() << "\n"; UnmapViewOfFile(responseBuffer); CloseHandle(hResponseMapFile); hResponseMapFile = NULL; responseBuffer = NULL; return false; } std::cout << "[+] Response communication channel initialized.\n"; return true; } void unloadDll() { if (hInjectedDll) { hInjectedDll = NULL; } if (remoteArgMemory) { VirtualFreeEx(hProcess, remoteArgMemory, 0, MEM_RELEASE); remoteArgMemory = nullptr; } if (!injectedDllPath.empty()) DeleteFileA(injectedDllPath.c_str()); } /** Calls an exported function in the injected DLL with no arguments */ bool invokeMethod(const char *functionName) { char dummy = 0; return invokeMethod(functionName, dummy); } /** Calls an exported function in the injected DLL with the given arguments */ template bool invokeMethod(const char *functionName, T args) { if (!hInjectedDll) { std::cerr << "[!] DLL not injected.\n"; return false; } if (!localModuleBase) { std::cerr << "[!] Local module base not set.\n"; return false; } // Get function address from locally loaded DLL FARPROC localFunc = GetProcAddress(hInjectedDll, functionName); if (!localFunc) { std::cerr << "[!] Function '" << functionName << "' not found.\n"; return false; } // Calculate offset from local DLL base uintptr_t offset = reinterpret_cast(localFunc) - localModuleBase; // Calculate remote function address uintptr_t remoteFuncAddr = remoteModuleBase + offset; // Allocate memory in remote process for arguments if (!remoteArgMemory) { size_t allocSize = sizeof(T) + 16; remoteArgMemory = VirtualAllocEx(hProcess, nullptr, allocSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!remoteArgMemory) { std::cerr << "[!] Failed to allocate memory in target process.\n"; return false; } } // Write arguments to remote memory if (!WriteProcessMemory(hProcess, remoteArgMemory, &args, sizeof(T), nullptr)) { std::cerr << "[!] Failed to write arguments to remote process.\n"; return false; } // Create remote thread to execute function HANDLE hThread = CreateRemoteThread( hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)remoteFuncAddr, remoteArgMemory, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread.\n"; return false; } // Wait for execution with timeout DWORD waitResult = WaitForSingleObject(hThread, 5000); if (waitResult == WAIT_TIMEOUT) { std::cerr << "[!] Remote function timed out.\n"; TerminateThread(hThread, 0); CloseHandle(hThread); return false; } else if (waitResult != WAIT_OBJECT_0) { std::cerr << "[!] WaitForSingleObject failed.\n"; CloseHandle(hThread); return false; } DWORD exitCode = 0; GetExitCodeThread(hThread, &exitCode); CloseHandle(hThread); std::cout << "[+] Function invoked successfully.\n"; return exitCode == 1; } /** Invoke an exported function and wait for a string response from the DLL */ std::string invokeMethodReturn(const char *functionName) { if (!hInjectedDll) { std::cerr << "[!] DLL not injected.\n"; return ""; } if (!hResponseEvent) { std::cerr << "[!] Response channel not initialized.\n"; return ""; } // Get function address from locally loaded DLL FARPROC localFunc = GetProcAddress(hInjectedDll, functionName); if (!localFunc) { std::cerr << "[!] Function '" << functionName << "' not found.\n"; return ""; } // Calculate offset from local DLL base uintptr_t offset = reinterpret_cast(localFunc) - localModuleBase; // Calculate remote function address uintptr_t remoteFuncAddr = remoteModuleBase + offset; // Create remote thread to execute function (no arguments needed for response functions) HANDLE hThread = CreateRemoteThread( hProcess, nullptr, 0, (LPTHREAD_START_ROUTINE)remoteFuncAddr, nullptr, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread.\n"; return ""; } // Wait for thread execution WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); // Wait for the response event with a timeout DWORD waitResult = WaitForSingleObject(hResponseEvent, 5000); // 5 seconds timeout if (waitResult == WAIT_TIMEOUT) { std::cerr << "[!] Response timeout after 5 seconds.\n"; return ""; } else if (waitResult == WAIT_FAILED) { std::cerr << "[!] WaitForSingleObject failed: " << GetLastError() << "\n"; return ""; } // Read the response from shared memory size_t length = *reinterpret_cast(responseBuffer); if (length >= responseBufferSize - sizeof(size_t)) { std::cerr << "[!] Response length exceeds buffer size.\n"; return ""; } char *msgPtr = static_cast(responseBuffer) + sizeof(size_t); std::string response(msgPtr, length); return response; } }; ================================================ FILE: Game Trainers/common/include/MinHook.h ================================================ /* * MinHook - The Minimalistic API Hooking Library for x64/x86 * Copyright (C) 2009-2017 Tsuda Kageyu. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #if !(defined _M_IX86) && !(defined _M_X64) && !(defined __i386__) && !(defined __x86_64__) #error MinHook supports only x86 and x64 systems. #endif #include // MinHook Error Codes. typedef enum MH_STATUS { // Unknown error. Should not be returned. MH_UNKNOWN = -1, // Successful. MH_OK = 0, // MinHook is already initialized. MH_ERROR_ALREADY_INITIALIZED, // MinHook is not initialized yet, or already uninitialized. MH_ERROR_NOT_INITIALIZED, // The hook for the specified target function is already created. MH_ERROR_ALREADY_CREATED, // The hook for the specified target function is not created yet. MH_ERROR_NOT_CREATED, // The hook for the specified target function is already enabled. MH_ERROR_ENABLED, // The hook for the specified target function is not enabled yet, or already // disabled. MH_ERROR_DISABLED, // The specified pointer is invalid. It points the address of non-allocated // and/or non-executable region. MH_ERROR_NOT_EXECUTABLE, // The specified target function cannot be hooked. MH_ERROR_UNSUPPORTED_FUNCTION, // Failed to allocate memory. MH_ERROR_MEMORY_ALLOC, // Failed to change the memory protection. MH_ERROR_MEMORY_PROTECT, // The specified module is not loaded. MH_ERROR_MODULE_NOT_FOUND, // The specified function is not found. MH_ERROR_FUNCTION_NOT_FOUND } MH_STATUS; // Can be passed as a parameter to MH_EnableHook, MH_DisableHook, // MH_QueueEnableHook or MH_QueueDisableHook. #define MH_ALL_HOOKS NULL #ifdef __cplusplus extern "C" { #endif // Initialize the MinHook library. You must call this function EXACTLY ONCE // at the beginning of your program. MH_STATUS WINAPI MH_Initialize(VOID); // Uninitialize the MinHook library. You must call this function EXACTLY // ONCE at the end of your program. MH_STATUS WINAPI MH_Uninitialize(VOID); // Creates a hook for the specified target function, in disabled state. // Parameters: // pTarget [in] A pointer to the target function, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal); // Creates a hook for the specified API function, in disabled state. // Parameters: // pszModule [in] A pointer to the loaded module name which contains the // target function. // pszProcName [in] A pointer to the target function name, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApi( LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal); // Creates a hook for the specified API function, in disabled state. // Parameters: // pszModule [in] A pointer to the loaded module name which contains the // target function. // pszProcName [in] A pointer to the target function name, which will be // overridden by the detour function. // pDetour [in] A pointer to the detour function, which will override // the target function. // ppOriginal [out] A pointer to the trampoline function, which will be // used to call the original target function. // This parameter can be NULL. // ppTarget [out] A pointer to the target function, which will be used // with other functions. // This parameter can be NULL. MH_STATUS WINAPI MH_CreateHookApiEx( LPCWSTR pszModule, LPCSTR pszProcName, LPVOID pDetour, LPVOID *ppOriginal, LPVOID *ppTarget); // Removes an already created hook. // Parameters: // pTarget [in] A pointer to the target function. MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget); // Enables an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // enabled in one go. MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget); // Disables an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // disabled in one go. MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget); // Queues to enable an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // queued to be enabled. MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget); // Queues to disable an already created hook. // Parameters: // pTarget [in] A pointer to the target function. // If this parameter is MH_ALL_HOOKS, all created hooks are // queued to be disabled. MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget); // Applies all queued changes in one go. MH_STATUS WINAPI MH_ApplyQueued(VOID); // Translates the MH_STATUS to its name as a string. const char * WINAPI MH_StatusToString(MH_STATUS status); #ifdef __cplusplus } #endif ================================================ FILE: Game Trainers/common/include/MonoBase.h ================================================ // MonoBase.h #pragma once #include #include "TrainerBase.h" #include #include #include #include class MonoBase : public TrainerBase { public: using Param = std::variant; MonoBase(const std::wstring &processIdentifier, bool useWindowTitle = false) : TrainerBase(processIdentifier, useWindowTitle) { } virtual ~MonoBase() { cleanUp(); } void cleanUp() override { // Note: MonoBridge.dll and GCMInjection.dll are not freed TrainerBase::cleanUp(); if (loggingBuffer) { UnmapViewOfFile(loggingBuffer); loggingBuffer = NULL; } if (hLoggingMapFile) { CloseHandle(hLoggingMapFile); hLoggingMapFile = NULL; } if (responseBuffer) { UnmapViewOfFile(responseBuffer); responseBuffer = NULL; } if (hResponseMapFile) { CloseHandle(hResponseMapFile); hResponseMapFile = NULL; } if (hResponseEvent) { CloseHandle(hResponseEvent); hResponseEvent = NULL; } if (!bridgeDllPath.empty()) { DeleteFileW(bridgeDllPath.c_str()); // Remove the subdirectory WCHAR dirPath[MAX_PATH]; wcscpy_s(dirPath, MAX_PATH, bridgeDllPath.c_str()); PathRemoveFileSpecW(dirPath); RemoveDirectoryW(dirPath); bridgeDllPath.clear(); } if (extractedFiles.size() > 0) { for (const auto &file : extractedFiles) { DeleteFileW(file.c_str()); } extractedFiles.clear(); } dllInjected = false; } bool initializeDllInjection() { if (!dllInjected) { if (!injectBridgeDLL()) return false; if (!getFunctionPointers()) return false; if (!loadAssembly("GCMINJECTION_DLL")) return false; if (!invokeMethod("", "GCMInjection", "Initialize", {})) { std::cerr << "[!] Failed to initialize dispatcher.\n"; return false; } if (!initializeLoggingChannel()) { std::cerr << "[!] Failed to initialize data logging channel.\n"; return false; } if (!initializeRequestChannel()) { std::cerr << "[!] Failed to initialize data request channel.\n"; return false; } dllInjected = true; } return dllInjected; } bool initializeLoggingChannel() { std::string loggingSharedMemName = "TrainerLoggingSharedMemory_" + std::to_string(procId); hLoggingMapFile = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, loggingBufferSize, loggingSharedMemName.c_str()); if (hLoggingMapFile == NULL) { std::cerr << "[!] Could not create file mapping object: " << GetLastError() << "\n"; return false; } loggingBuffer = MapViewOfFile(hLoggingMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (loggingBuffer == NULL) { std::cerr << "[!] Could not map view of file: " << GetLastError() << "\n"; CloseHandle(hLoggingMapFile); hLoggingMapFile = NULL; return false; } return true; } static void check_logging_available(void *data) { MonoBase *self = static_cast(data); if (self->loggingBuffer != nullptr) { SharedMemoryHeader *header = static_cast(self->loggingBuffer); char *bufferStart = static_cast(self->loggingBuffer) + sizeof(SharedMemoryHeader); std::lock_guard lock(header->mutex); while (header->head != header->tail) { size_t length = *reinterpret_cast(bufferStart + header->tail); char *msgPtr = bufferStart + header->tail + sizeof(size_t); std::string message(msgPtr, length); std::cout << message << "\n"; header->tail = (header->tail + sizeof(size_t) + length) % (self->loggingBufferSize - sizeof(SharedMemoryHeader)); } } Fl::repeat_timeout(0.1, check_logging_available, data); } bool initializeRequestChannel() { std::string responseSharedMemName = "TrainerResponseSharedMemory_" + std::to_string(procId); hResponseMapFile = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, responseBufferSize, responseSharedMemName.c_str()); if (hResponseMapFile == NULL) { std::cerr << "[!] Could not create response file mapping object: " << GetLastError() << "\n"; return false; } responseBuffer = MapViewOfFile(hResponseMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (responseBuffer == NULL) { std::cerr << "[!] Could not map view of response file: " << GetLastError() << "\n"; CloseHandle(hResponseMapFile); hResponseMapFile = NULL; return false; } std::string eventName = "TrainerResponseEvent_" + std::to_string(procId); hResponseEvent = CreateEventA(NULL, FALSE, FALSE, eventName.c_str()); if (hResponseEvent == NULL) { std::cerr << "[!] Could not create response event: " << GetLastError() << "\n"; UnmapViewOfFile(responseBuffer); CloseHandle(hResponseMapFile); hResponseMapFile = NULL; responseBuffer = NULL; return false; } return true; } /** Injects the C++ bridge DLL into the target process from embedded resources * @return True if injection succeeds, false otherwise */ bool injectBridgeDLL() { // Extract the DLL from resources bridgeDllPath = extractResourceToTempFile("MONOBRIDGE_DLL"); if (bridgeDllPath.empty()) { std::cerr << "[!] Failed to extract MonoBridge.dll from resources.\n"; return false; } if (!hProcess || !isProcessRunning()) { std::cerr << "[!] Process not running or handle invalid.\n"; return false; } size_t pathSize = (bridgeDllPath.size() + 1) * sizeof(wchar_t); LPVOID allocMem = VirtualAllocEx(hProcess, nullptr, pathSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!allocMem) { std::cerr << "[!] Failed to allocate memory in target process.\n"; return false; } if (!WriteProcessMemory(hProcess, allocMem, bridgeDllPath.c_str(), pathSize, nullptr)) { std::cerr << "[!] Failed to write DLL path to target process.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } // Combine kernel32 handle and LoadLibraryW address retrieval HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll"); LPVOID loadLibraryAddr = kernel32 ? reinterpret_cast(GetProcAddress(kernel32, "LoadLibraryW")) : nullptr; if (!loadLibraryAddr) { std::cerr << "[!] Failed to get LoadLibraryW address.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, reinterpret_cast(loadLibraryAddr), allocMem, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread for LoadLibraryW.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } WaitForSingleObject(hThread, INFINITE); DWORD exitCode = 0; GetExitCodeThread(hThread, &exitCode); CloseHandle(hThread); if (exitCode == 0) { std::cerr << "[!] LoadLibraryW failed in target process.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } bridgeDllBase = static_cast(exitCode); VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return true; } /** Retrieves function pointers from the injected bridge DLL * @return True if pointers are retrieved, false otherwise */ bool getFunctionPointers() { if (!hProcess || !bridgeDllBase) { std::cerr << "[!] Process handle invalid or bridge DLL not injected.\n"; return false; } HMODULE hLocalDll = LoadLibraryW(bridgeDllPath.c_str()); if (!hLocalDll) { std::cerr << "[!] Failed to load bridge DLL locally from " << wstringToString(bridgeDllPath) << std::endl; return false; } FARPROC localGetFuncPtrs = GetProcAddress(hLocalDll, "GetFunctionPointersThread"); if (!localGetFuncPtrs) { std::cerr << "[!] Failed to get address of GetFunctionPointersThread.\n"; FreeLibrary(hLocalDll); return false; } uintptr_t localBase = reinterpret_cast(hLocalDll); uintptr_t localAddr = reinterpret_cast(localGetFuncPtrs); uintptr_t rva = localAddr - localBase; LPVOID remoteGetFuncPtrs = reinterpret_cast(bridgeDllBase + rva); LPVOID allocMem = VirtualAllocEx(hProcess, nullptr, sizeof(FunctionPointers), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!allocMem) { std::cerr << "[!] Failed to allocate memory for function pointers.\n"; FreeLibrary(hLocalDll); return false; } HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, reinterpret_cast(remoteGetFuncPtrs), allocMem, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread for function pointers.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); FreeLibrary(hLocalDll); return false; } WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); if (!ReadProcessMemory(hProcess, allocMem, &funcPtrs, sizeof(FunctionPointers), nullptr)) { std::cerr << "[!] Failed to read function pointers from target process.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); FreeLibrary(hLocalDll); return false; } VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); FreeLibrary(hLocalDll); return true; } /** Loads a C# assembly from an embedded resource into the Mono runtime * @param resourceName Name of the resource (e.g., "GCMINJECTION_DLL") * @return True if successful, false otherwise */ bool loadAssembly(const std::string &resourceName) { if (!hProcess || !funcPtrs.LoadAssemblyThread) { std::cerr << "[!] Process handle invalid or LoadAssemblyThread pointer missing.\n"; return false; } std::wstring assemblyPath = extractResourceToTempFile(resourceName); if (assemblyPath.empty()) { std::cerr << "[!] Failed to extract assembly from resource: " << resourceName << "\n"; return false; } extractedFiles.push_back(assemblyPath); std::string pathStr = wstringToString(assemblyPath); size_t pathLen = pathStr.size() + 1; size_t paramsSize = sizeof(LoadAssemblyParams) + pathLen; LPVOID allocMem = VirtualAllocEx(hProcess, nullptr, paramsSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!allocMem) { std::cerr << "[!] Failed to allocate memory for assembly path.\n"; return false; } LPVOID pathMem = reinterpret_cast(reinterpret_cast(allocMem) + sizeof(LoadAssemblyParams)); if (!WriteProcessMemory(hProcess, pathMem, pathStr.c_str(), pathLen, nullptr)) { std::cerr << "[!] Failed to write assembly path to target process.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } LoadAssemblyParams params{}; params.path = reinterpret_cast(pathMem); if (!WriteProcessMemory(hProcess, allocMem, ¶ms, sizeof(LoadAssemblyParams), nullptr)) { std::cerr << "[!] Failed to write LoadAssemblyParams to target process.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, reinterpret_cast(funcPtrs.LoadAssemblyThread), allocMem, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread to load assembly.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return true; } /** Invokes a static method in the loaded C# assembly * @param namespaceName Namespace of the class (e.g., "MyNamespace") * @param className Class name (e.g., "MyClass") * @param methodName Method name (e.g., "MyMethod") * @param params Vector of parameters * @return True if successful, false otherwise */ bool invokeMethod(const std::string &namespaceName, const std::string &className, const std::string &methodName, const std::vector ¶ms) { if (!hProcess || !funcPtrs.InvokeMethodThread) { std::cerr << "[!] Process handle invalid or InvokeMethodThread pointer missing.\n"; return false; } size_t namespaceLen = namespaceName.size() + 1; size_t classLen = className.size() + 1; size_t methodLen = methodName.size() + 1; size_t paramValuesSize = sizeof(ParamValue) * params.size(); size_t totalStringSize = 0; for (const auto &p : params) { if (std::holds_alternative(p)) totalStringSize += std::get(p).size() + 1; } size_t totalSize = sizeof(InvokeMethodParams) + namespaceLen + classLen + methodLen + paramValuesSize + totalStringSize; LPVOID allocMem = VirtualAllocEx(hProcess, nullptr, totalSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); if (!allocMem) { std::cerr << "[!] Failed to allocate memory for method invocation.\n"; return false; } LPVOID currentMem = reinterpret_cast(reinterpret_cast(allocMem) + sizeof(InvokeMethodParams)); InvokeMethodParams invokeParams{}; // Write namespace invokeParams.namespaceName = reinterpret_cast(currentMem); if (!WriteProcessMemory(hProcess, currentMem, namespaceName.c_str(), namespaceLen, nullptr)) { std::cerr << "[!] Failed to write namespace name.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } currentMem = reinterpret_cast(reinterpret_cast(currentMem) + namespaceLen); // Write class name invokeParams.className = reinterpret_cast(currentMem); if (!WriteProcessMemory(hProcess, currentMem, className.c_str(), classLen, nullptr)) { std::cerr << "[!] Failed to write class name.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } currentMem = reinterpret_cast(reinterpret_cast(currentMem) + classLen); // Write method name invokeParams.methodName = reinterpret_cast(currentMem); if (!WriteProcessMemory(hProcess, currentMem, methodName.c_str(), methodLen, nullptr)) { std::cerr << "[!] Failed to write method name.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } currentMem = reinterpret_cast(reinterpret_cast(currentMem) + methodLen); // Write parameter values LPVOID paramValuesMem = currentMem; std::vector paramValues(params.size()); for (size_t i = 0; i < params.size(); ++i) { if (std::holds_alternative(params[i])) { paramValues[i].type = ParamValue::INT; paramValues[i].i = std::get(params[i]); } else if (std::holds_alternative(params[i])) { paramValues[i].type = ParamValue::FLOAT; paramValues[i].f = std::get(params[i]); } else if (std::holds_alternative(params[i])) { paramValues[i].type = ParamValue::STRING; const std::string &str = std::get(params[i]); paramValues[i].s = reinterpret_cast(currentMem); if (!WriteProcessMemory(hProcess, currentMem, str.c_str(), str.size() + 1, nullptr)) { std::cerr << "[!] Failed to write string parameter.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } currentMem = reinterpret_cast(reinterpret_cast(currentMem) + str.size() + 1); } } invokeParams.paramCount = static_cast(params.size()); invokeParams.paramValues = reinterpret_cast(paramValuesMem); if (!WriteProcessMemory(hProcess, paramValuesMem, paramValues.data(), paramValuesSize, nullptr)) { std::cerr << "[!] Failed to write parameter values.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } // Write InvokeMethodParams if (!WriteProcessMemory(hProcess, allocMem, &invokeParams, sizeof(InvokeMethodParams), nullptr)) { std::cerr << "[!] Failed to write InvokeMethodParams.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } HANDLE hThread = CreateRemoteThread(hProcess, nullptr, 0, reinterpret_cast(funcPtrs.InvokeMethodThread), allocMem, 0, nullptr); if (!hThread) { std::cerr << "[!] Failed to create remote thread for method invocation.\n"; VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return false; } std::stringstream ss; ss << "[+] Invoked method " << (namespaceName.empty() ? "" : namespaceName + ".") << className << "." << methodName << "("; for (size_t i = 0; i < params.size(); ++i) { if (i > 0) ss << ", "; if (std::holds_alternative(params[i])) ss << std::get(params[i]); else if (std::holds_alternative(params[i])) ss << std::get(params[i]); else if (std::holds_alternative(params[i])) ss << "\"" << std::get(params[i]) << "\""; } ss << ")\n"; std::cout << ss.str(); WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); VirtualFreeEx(hProcess, allocMem, 0, MEM_RELEASE); return true; } std::string invokeMethodReturn(const std::string &namespaceName, const std::string &className, const std::string &methodName, const std::vector ¶ms) { if (!invokeMethod(namespaceName, className, methodName, params)) { return ""; } // Wait for the response event with a timeout DWORD waitResult = WaitForSingleObject(hResponseEvent, 5000); // 5 seconds timeout if (waitResult == WAIT_TIMEOUT) { std::cerr << "[!] WaitForSingleObject timed out after 5 seconds\n"; return ""; } else if (waitResult == WAIT_FAILED) { std::cerr << "[!] WaitForSingleObject failed: " << GetLastError() << "\n"; return ""; } // Read the response size_t length = *reinterpret_cast(responseBuffer); if (length >= responseBufferSize - sizeof(size_t)) { std::cerr << "[!] Response length exceeds buffer size.\n"; return ""; } char *msgPtr = static_cast(responseBuffer) + sizeof(size_t); std::string response(msgPtr, length); return response; } private: bool dllInjected = false; std::vector extractedFiles; std::wstring bridgeDllPath; uintptr_t bridgeDllBase = 0; // For injected dll communication HANDLE hLoggingMapFile = NULL; LPVOID loggingBuffer = nullptr; const size_t loggingBufferSize = 1024 * 1024; HANDLE hResponseMapFile = NULL; LPVOID responseBuffer = NULL; HANDLE hResponseEvent = NULL; const size_t responseBufferSize = 1024 * 1024; struct FunctionPointers { LPVOID LoadAssemblyThread = nullptr; LPVOID InvokeMethodThread = nullptr; } funcPtrs; struct LoadAssemblyParams { const char *path; }; struct ParamValue { enum Type { INT, FLOAT, STRING } type; union { int i; float f; const char *s; }; }; struct InvokeMethodParams { const char *namespaceName; const char *className; const char *methodName; int paramCount; ParamValue *paramValues; }; struct SharedMemoryHeader { size_t head; size_t tail; std::mutex mutex; }; /** Extracts a DLL from embedded resources to a temporary file * @param resourceName The resource identifier (e.g., "MONOBRIDGE_DLL") * @return Path to the temporary file, or empty string if extraction fails */ std::wstring extractResourceToTempFile(const std::string &resourceName) { HMODULE hModule = GetModuleHandle(nullptr); HRSRC hResource = FindResourceA(hModule, resourceName.c_str(), MAKEINTRESOURCEA(10)); if (!hResource) { std::cerr << "[!] Failed to find resource: " << resourceName << "\n"; return L""; } HGLOBAL hData = LoadResource(hModule, hResource); if (!hData) { std::cerr << "[!] Failed to load resource: " << resourceName << "\n"; return L""; } LPVOID pData = LockResource(hData); if (!pData) { std::cerr << "[!] Failed to lock resource: " << resourceName << "\n"; return L""; } DWORD dwSize = SizeofResource(hModule, hResource); WCHAR tempPath[MAX_PATH]; if (resourceName == "MONOBRIDGE_DLL") { // Create a unique subdirectory to avoid name collisions GUID guid; CoCreateGuid(&guid); WCHAR subDir[MAX_PATH]; StringFromGUID2(guid, subDir, MAX_PATH); // Generates a unique string like "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" GetTempPathW(MAX_PATH, tempPath); wcscat_s(tempPath, MAX_PATH, subDir); CreateDirectoryW(tempPath, nullptr); // Construct the full path with the desired name WCHAR dllPath[MAX_PATH]; wcscpy_s(dllPath, MAX_PATH, tempPath); wcscat_s(dllPath, MAX_PATH, L"\\"); wcscat_s(dllPath, MAX_PATH, L"MonoBridge.dll"); HANDLE hFile = CreateFileW(dllPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { std::cerr << "[!] Failed to create MonoBridge file: " << wstringToString(dllPath) << "\n"; return L""; } DWORD bytesWritten; WriteFile(hFile, pData, dwSize, &bytesWritten, nullptr); CloseHandle(hFile); if (bytesWritten != dwSize) { std::cerr << "[!] Failed to write MonoBridge resource to file: " << wstringToString(dllPath) << "\n"; DeleteFileW(dllPath); return L""; } return std::wstring(dllPath); } else { // Default behavior: use a temporary filename WCHAR tempFileName[MAX_PATH]; GetTempPathW(MAX_PATH, tempPath); GetTempFileNameW(tempPath, L"RES", 0, tempFileName); HANDLE hFile = CreateFileW(tempFileName, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { std::cerr << "[!] Failed to create temporary file for resource.\n"; return L""; } DWORD bytesWritten; WriteFile(hFile, pData, dwSize, &bytesWritten, nullptr); CloseHandle(hFile); if (bytesWritten != dwSize) { std::cerr << "[!] Failed to write resource to temporary file.\n"; DeleteFileW(tempFileName); return L""; } return std::wstring(tempFileName); } } }; ================================================ FILE: Game Trainers/common/include/MonoBridge.cpp ================================================ #include #include #include #include #define MONO_API extern "C" __declspec(dllimport) typedef void *MonoDomain; typedef void *MonoAssembly; typedef void *MonoImage; typedef void *MonoClass; typedef void *MonoMethod; typedef void *MonoObject; typedef void *MonoThread; typedef void *MonoString; MONO_API MonoDomain *mono_get_root_domain(); MONO_API MonoThread *mono_thread_attach(MonoDomain *domain); MONO_API MonoAssembly *mono_assembly_open(const char *filename, void *status); MONO_API MonoAssembly *mono_domain_assembly_open(MonoDomain *domain, const char *name); MONO_API MonoImage *mono_assembly_get_image(MonoAssembly *assembly); MONO_API MonoClass *mono_class_from_name(MonoImage *image, const char *name_space, const char *name); MONO_API MonoMethod *mono_class_get_method_from_name(MonoClass *klass, const char *name, int param_count); MONO_API MonoObject *mono_runtime_invoke(MonoMethod *method, void *obj, void **params, MonoObject **exc); MONO_API MonoString *mono_string_new(MonoDomain *domain, const char *str); struct ParamValue { enum Type { INT, FLOAT, STRING } type; union { int i; float f; const char *s; }; }; struct FunctionPointers { LPVOID LoadAssemblyThread; LPVOID InvokeMethodThread; }; struct LoadAssemblyParams { const char *path; }; struct InvokeMethodParams { const char *namespaceName; const char *className; const char *methodName; int paramCount; ParamValue *paramValues; }; struct SharedMemoryHeader { size_t head; size_t tail; std::mutex mutex; }; MonoDomain *domain = nullptr; MonoAssembly *loadedAssembly = nullptr; static HANDLE hLoggingMapFile = NULL; static LPVOID loggingBuffer = NULL; static const size_t loggingBufferSize = 1024 * 1024; // 1MB static HANDLE hResponseMapFile = NULL; static LPVOID responseBuffer = NULL; static const size_t responseBufferSize = 1024 * 1024; extern "C" __declspec(dllexport) void SendData(const char *message) { if (loggingBuffer == NULL) { DWORD pid = GetCurrentProcessId(); std::string loggingSharedMemName = "TrainerLoggingSharedMemory_" + std::to_string(pid); hLoggingMapFile = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, loggingSharedMemName.c_str()); if (hLoggingMapFile == NULL) { DWORD errorCode = GetLastError(); return; } loggingBuffer = MapViewOfFile(hLoggingMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (loggingBuffer == NULL) { DWORD errorCode = GetLastError(); CloseHandle(hLoggingMapFile); hLoggingMapFile = NULL; return; } } // Validate the message if (message == NULL) { return; } size_t length = strlen(message); if (length + sizeof(size_t) > loggingBufferSize) { return; } SharedMemoryHeader *header = static_cast(loggingBuffer); char *bufferStart = static_cast(loggingBuffer) + sizeof(SharedMemoryHeader); std::lock_guard lock(header->mutex); size_t nextHead = (header->head + sizeof(size_t) + length) % (loggingBufferSize - sizeof(SharedMemoryHeader)); if ((header->head < header->tail && nextHead >= header->tail) || (header->head >= header->tail && nextHead < header->head && nextHead >= header->tail)) { // Queue is full return; } *reinterpret_cast(bufferStart + header->head) = length; memcpy(bufferStart + header->head + sizeof(size_t), message, length); header->head = nextHead; } void Log(const char *message) { std::string formattedMessage = "[MonoBridge] " + std::string(message); SendData(formattedMessage.c_str()); } void LogToFile(const char *message) { std::string formattedMessage = "[MonoBridge] " + std::string(message) + "\n"; HANDLE hFile = CreateFileA("monobridge_log.txt", FILE_APPEND_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { DWORD written; WriteFile(hFile, formattedMessage.c_str(), static_cast(formattedMessage.size()), &written, NULL); CloseHandle(hFile); } } extern "C" __declspec(dllexport) void SendResponse(const char *message) { if (responseBuffer == NULL) { DWORD pid = GetCurrentProcessId(); std::string responseSharedMemName = "TrainerResponseSharedMemory_" + std::to_string(pid); hResponseMapFile = OpenFileMappingA(FILE_MAP_ALL_ACCESS, FALSE, responseSharedMemName.c_str()); if (hResponseMapFile == NULL) { Log("[!] Could not open response file mapping object"); return; } responseBuffer = MapViewOfFile(hResponseMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (responseBuffer == NULL) { Log("[!] Could not map view of response file"); CloseHandle(hResponseMapFile); hResponseMapFile = NULL; return; } } if (message == NULL) { Log("[!] Null message in SendResponse"); return; } size_t length = strlen(message); if (length + sizeof(size_t) > responseBufferSize) { Log("[!] Response too large for buffer"); return; } *reinterpret_cast(responseBuffer) = length; memcpy(static_cast(responseBuffer) + sizeof(size_t), message, length); DWORD pid = GetCurrentProcessId(); std::string eventName = "TrainerResponseEvent_" + std::to_string(pid); HANDLE hEvent = OpenEventA(EVENT_MODIFY_STATE, FALSE, eventName.c_str()); if (hEvent != NULL) { SetEvent(hEvent); CloseHandle(hEvent); } else { Log("[!] Could not open response event"); } } void InitializeMono() { if (domain) return; HMODULE monoModule = GetModuleHandleA("mono-2.0-bdwgc.dll"); if (!monoModule) { Log("[!] Failed to find mono-2.0-bdwgc.dll"); return; } auto getRootDomain = (MonoDomain * (*)()) GetProcAddress(monoModule, "mono_get_root_domain"); auto threadAttach = (MonoThread * (*)(MonoDomain *)) GetProcAddress(monoModule, "mono_thread_attach"); if (!getRootDomain || !threadAttach) { Log("[!] Failed to get Mono functions"); return; } domain = getRootDomain(); if (!domain) { Log("[!] Failed to get root domain"); return; } threadAttach(domain); } void LoadAssembly(const char *path) { InitializeMono(); if (!domain) { Log("[!] Mono domain not initialized"); return; } HMODULE monoModule = GetModuleHandleA("mono-2.0-bdwgc.dll"); auto assemblyOpen = (MonoAssembly * (*)(const char *, void *)) GetProcAddress(monoModule, "mono_assembly_open"); if (!assemblyOpen) { Log("[!] Failed to get mono_assembly_open"); return; } loadedAssembly = assemblyOpen(path, nullptr); if (!loadedAssembly) { Log("[!] Failed to load assembly"); } } extern "C" __declspec(dllexport) DWORD WINAPI LoadAssemblyThread(LPVOID lpParam) { LoadAssemblyParams *params = static_cast(lpParam); LoadAssembly(params->path); return 0; } extern "C" __declspec(dllexport) DWORD WINAPI InvokeMethodThread(LPVOID lpParam) { InvokeMethodParams *params = static_cast(lpParam); InitializeMono(); if (!domain) { Log("[!] Mono domain not initialized"); return 1; } HMODULE monoModule = GetModuleHandleA("mono-2.0-bdwgc.dll"); if (monoModule) { // CRITICAL: Attach the thread to the Mono domain auto threadAttach = (MonoThread * (*)(MonoDomain *)) GetProcAddress(monoModule, "mono_thread_attach"); if (threadAttach && domain) { threadAttach(domain); } } else { Log("[!] Failed to get mono-2.0-bdwgc.dll handle"); return 1; } auto getImage = (MonoImage * (*)(MonoAssembly *)) GetProcAddress(monoModule, "mono_assembly_get_image"); auto classFromName = (MonoClass * (*)(MonoImage *, const char *, const char *)) GetProcAddress(monoModule, "mono_class_from_name"); auto getMethod = (MonoMethod * (*)(MonoClass *, const char *, int)) GetProcAddress(monoModule, "mono_class_get_method_from_name"); auto runtimeInvoke = (MonoObject * (*)(MonoMethod *, void *, void **, MonoObject **)) GetProcAddress(monoModule, "mono_runtime_invoke"); auto stringNew = (MonoString * (*)(MonoDomain *, const char *)) GetProcAddress(monoModule, "mono_string_new"); if (!getImage || !classFromName || !getMethod || !runtimeInvoke || !stringNew) { Log("[!] Failed to get required Mono functions"); return 1; } if (!loadedAssembly) { Log("[!] No assembly loaded"); return 1; } MonoImage *image = getImage(loadedAssembly); if (!image) { Log("[!] Failed to get image"); return 1; } MonoClass *klass = classFromName(image, params->namespaceName, params->className); if (!klass) { Log("[!] Failed to find class"); return 1; } MonoMethod *method = getMethod(klass, params->methodName, params->paramCount); if (!method) { Log("[!] Failed to find method"); return 1; } std::vector args(params->paramCount); std::vector intParams; std::vector floatParams; std::vector stringParams; for (int i = 0; i < params->paramCount; ++i) { ParamValue &pv = params->paramValues[i]; switch (pv.type) { case ParamValue::INT: intParams.push_back(pv.i); args[i] = &intParams.back(); break; case ParamValue::FLOAT: floatParams.push_back(pv.f); args[i] = &floatParams.back(); break; case ParamValue::STRING: { MonoString *monoStr = stringNew(domain, pv.s); if (!monoStr) { Log("[!] Failed to create MonoString"); return 1; } stringParams.push_back(monoStr); args[i] = monoStr; break; } default: Log("[!] Unsupported parameter type"); return 1; } } MonoObject *exc = nullptr; runtimeInvoke(method, nullptr, args.empty() ? nullptr : args.data(), &exc); if (exc) { Log("[!] Exception during method invocation"); return 1; } return 0; } extern "C" __declspec(dllexport) DWORD WINAPI GetFunctionPointersThread(LPVOID lpParam) { FunctionPointers *ptrs = static_cast(lpParam); ptrs->LoadAssemblyThread = LoadAssemblyThread; ptrs->InvokeMethodThread = InvokeMethodThread; return 0; } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { return TRUE; } ================================================ FILE: Game Trainers/common/include/MonoBridge.def ================================================ LIBRARY MonoBridge EXPORTS GetFunctionPointersThread LoadAssemblyThread InvokeMethodThread SendData ================================================ FILE: Game Trainers/common/include/TrainerBase.h ================================================ // TrainerBase.h #pragma once #include #include #include #include #include #include #include #include /*********************************************************************** * HOOK_INFO: Track data about one named hook ***********************************************************************/ struct HookInfo { std::string hookName; // e.g., "ArrowFrequency" uintptr_t hookAddress; // Where we overwrite bytes size_t overwriteLen; // Number of bytes overwritten std::vector originalBytes; bool active = false; LPVOID allocatedMem = nullptr; size_t allocSize = 0; }; /*********************************************************************** * WILDCARD PATTERN BYTE * If text == "??" => wildcard * Otherwise, parse hex ***********************************************************************/ struct PatternByte { bool wildcard; BYTE value; }; /*********************************************************************** * POINTER_TOGGLE_INFO: Track data about one pointer-based toggle ***********************************************************************/ struct PointerToggleInfo { std::string toggleName; std::vector offsets; std::any desiredValue; size_t valueSize; bool active = false; std::thread toggleThread; // Destructor to ensure the thread is joined ~PointerToggleInfo() { active = false; if (toggleThread.joinable()) toggleThread.join(); } }; class TrainerBase { public: TrainerBase(const std::wstring &processIdentifier, bool useWindowTitle = false) : processName(processIdentifier), useWindowTitle(useWindowTitle) { SetConsoleOutputCP(CP_UTF8); } virtual ~TrainerBase() { cleanUp(); } std::wstring getProcessName() const { return processName; } DWORD getProcessId() const { return procId; } virtual void cleanUp() { disableAllHooks(); disableAllPointerToggles(); if (hProcess) CloseHandle(hProcess); hProcess = nullptr; } // Check if the target process is running and open a handle bool isProcessRunning() { if (useWindowTitle) { procId = getProcIdByWindowTitle(processName); } else { procId = getProcId(processName.c_str()); } if (procId == 0) { std::wcerr << L"[!] Could not find process: " << processName << std::endl; cleanUp(); return false; } if (!hProcess) { hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procId); if (!hProcess) { std::cerr << "[!] Failed to open process. Error: " << GetLastError() << std::endl; cleanUp(); return false; } } return true; } // Disable a specific named hook inline bool disableNamedHook(const std::string &name) { auto it = hooks.find(name); if (it == hooks.end()) return false; // Not found HookInfo &hi = it->second; if (!hi.active) return false; // Restore original bytes WriteProcessMemory(hProcess, reinterpret_cast(hi.hookAddress), hi.originalBytes.data(), hi.overwriteLen, nullptr); FlushInstructionCache(hProcess, reinterpret_cast(hi.hookAddress), hi.overwriteLen); // Free allocated memory if (hi.allocatedMem) { VirtualFreeEx(hProcess, hi.allocatedMem, 0, MEM_RELEASE); hi.allocatedMem = nullptr; } hi.active = false; std::cout << "[-] Disabled hook '" << name << "'\n"; return true; } // Disable all active hooks inline void disableAllHooks() { for (auto &kv : hooks) { HookInfo &hi = kv.second; if (hi.active) { // Restore original bytes WriteProcessMemory(hProcess, reinterpret_cast(hi.hookAddress), hi.originalBytes.data(), hi.overwriteLen, nullptr); FlushInstructionCache(hProcess, reinterpret_cast(hi.hookAddress), hi.overwriteLen); // Free allocated memory if (hi.allocatedMem) { VirtualFreeEx(hProcess, hi.allocatedMem, 0, MEM_RELEASE); hi.allocatedMem = nullptr; } hi.active = false; std::cout << "[-] Disabled hook '" << kv.first << "'\n"; } } hooks.clear(); } // Disable a specific pointer-based toggle inline bool disableNamedPointerToggle(const std::string &name) { auto it = pointerToggles.find(name); if (it == pointerToggles.end()) return false; // Not found auto pti = it->second; if (!pti->active) return false; pti->active = false; // Signal the thread to stop if (pti->toggleThread.joinable()) pti->toggleThread.join(); std::cout << "[-] Disabled pointer toggle '" << name << "'\n"; pointerToggles.erase(it); return true; } // Disable all active pointer-based toggles inline void disableAllPointerToggles() { for (auto &kv : pointerToggles) { auto pti = kv.second; if (pti->active) { pti->active = false; if (pti->toggleThread.joinable()) pti->toggleThread.join(); std::cout << "[-] Disabled pointer toggle '" << kv.first << "'\n"; } } pointerToggles.clear(); } protected: // Process and module information const std::wstring processName; // This can be either an exe name or a window title bool useWindowTitle = false; // Set to true if processName is a window title HANDLE hProcess = nullptr; DWORD procId = 0; // Maps to store hooks and pointer toggles by name std::map hooks; std::map> pointerToggles; /*********************************************************************** * Helper Functions ***********************************************************************/ /** Converts std::wstring to std::string * @param wstr The wide string to convert * @return Converted narrow string */ std::string wstringToString(const std::wstring &wstr) { if (wstr.empty()) return ""; int size = WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); std::string str(size, 0); WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(), &str[0], size, NULL, NULL); return str; } // Get Process ID by executable name inline DWORD getProcId(const wchar_t *exeName) { DWORD pid = 0; HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (snap == INVALID_HANDLE_VALUE) return 0; PROCESSENTRY32W pe; pe.dwSize = sizeof(pe); if (Process32FirstW(snap, &pe)) { do { if (!_wcsicmp(pe.szExeFile, exeName)) { pid = pe.th32ProcessID; break; } } while (Process32NextW(snap, &pe)); } CloseHandle(snap); return pid; } struct EnumWindowsData { std::wstring targetTitle; DWORD foundPID = 0; }; static BOOL CALLBACK EnumWindowsProcCallback(HWND hwnd, LPARAM lParam) { EnumWindowsData *data = reinterpret_cast(lParam); if (!IsWindowVisible(hwnd)) return TRUE; const int bufferSize = 256; wchar_t windowTitle[bufferSize] = {0}; GetWindowTextW(hwnd, windowTitle, bufferSize); if (data->targetTitle == windowTitle) { GetWindowThreadProcessId(hwnd, &(data->foundPID)); return FALSE; } return TRUE; } inline DWORD getProcIdByWindowTitle(const std::wstring &title) { EnumWindowsData data; data.targetTitle = title; EnumWindows(EnumWindowsProcCallback, reinterpret_cast(&data)); return data.foundPID; } // Get Module Base Address and Size inline bool getModuleInfo(const wchar_t *modName, uintptr_t &modBase, size_t &modSize) { HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procId); if (snap == INVALID_HANDLE_VALUE) { std::cerr << "[!] Failed to create module snapshot. Error: " << GetLastError() << std::endl; return false; } MODULEENTRY32W me; me.dwSize = sizeof(me); bool found = false; // Check if the module name starts with "$re$" for regex matching bool useRegex = false; std::wstring patternStr; const wchar_t *prefix = L"$re$"; size_t prefixLen = wcslen(prefix); if (wcsncmp(modName, prefix, prefixLen) == 0) { useRegex = true; patternStr = std::wstring(modName).substr(prefixLen); } if (Module32FirstW(snap, &me)) { do { // std::wcout << L"Module: " << me.szModule << std::endl; if ((!useRegex && _wcsicmp(me.szModule, modName) == 0) || (useRegex && std::regex_match(me.szModule, std::wregex(patternStr)))) { modBase = (uintptr_t)me.modBaseAddr; modSize = (size_t)me.modBaseSize; found = true; break; } } while (Module32NextW(snap, &me)); } CloseHandle(snap); return found; } // Resolve dynamic address via pointer chaining inline uintptr_t resolveModuleDynamicAddress(const wchar_t *moduleName, const std::vector &offsets) { uintptr_t modBase = 0; size_t modSize = 0; if (!getModuleInfo(moduleName, modBase, modSize)) { std::wcerr << L"[!] Could not find module: " << moduleName << std::endl; return 0; } // First offset is relative to moduleBase uintptr_t currentAddr = modBase + offsets[0]; // Subsequent offsets are pointer dereferences for (size_t i = 1; i < offsets.size(); i++) { if (!ReadProcessMemory(hProcess, (LPCVOID)currentAddr, ¤tAddr, sizeof(currentAddr), nullptr)) { std::cerr << "[!] Failed dereference pointer at 0x" << std::hex << currentAddr << std::dec << std::endl; return 0; } currentAddr += offsets[i]; } std::cout << "[+] Pointer dereferenced to 0x" << std::hex << currentAddr << std::dec << std::endl; return currentAddr; } template bool WriteToDynamicAddress(const wchar_t *moduleName, const std::vector &offsets, T value) { uintptr_t targetAddr = resolveModuleDynamicAddress(moduleName, offsets); if (targetAddr == 0) { return false; } if (!WriteProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(T), nullptr)) { std::cerr << "[!] WriteProcessMemory failed at address 0x" << std::hex << targetAddr << std::dec << ". Error: " << GetLastError() << std::endl; return false; } return true; } template T ReadFromDynamicAddress(const wchar_t *moduleName, const std::vector &offsets) { uintptr_t targetAddr = resolveModuleDynamicAddress(moduleName, offsets); if (targetAddr == 0) { return T(); } T value; if (!ReadProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(T), nullptr)) { std::cerr << "[!] ReadProcessMemory failed at address 0x" << std::hex << targetAddr << std::dec << ". Error: " << GetLastError() << std::endl; return T(); } return value; } // Find pattern with wildcards inline uintptr_t findPatternWild(const wchar_t *moduleName, const std::vector &pattern) { // Parse pattern std::vector pat; for (const auto &token : pattern) { pat.push_back((token == "??" || token == "?") ? PatternByte{true, 0} : PatternByte{false, (BYTE)std::stoul(token, nullptr, 16)}); } size_t patSize = pat.size(); if (moduleName == nullptr || wcslen(moduleName) == 0) { uintptr_t currentAddress = 0; MEMORY_BASIC_INFORMATION mbi; // Loop through all memory pages in the process while (VirtualQueryEx(hProcess, (LPCVOID)currentAddress, &mbi, sizeof(mbi))) { // We only care about memory that is committed and executable (where JIT code lives) if (mbi.State == MEM_COMMIT && (mbi.Protect & PAGE_EXECUTE_READ || mbi.Protect & PAGE_EXECUTE_READWRITE)) { std::vector buffer(mbi.RegionSize); SIZE_T bytesRead; if (ReadProcessMemory(hProcess, mbi.BaseAddress, buffer.data(), mbi.RegionSize, &bytesRead)) { for (size_t i = 0; i + patSize <= bytesRead; ++i) { bool found = true; for (size_t j = 0; j < patSize; ++j) { if (!pat[j].wildcard && pat[j].value != buffer[i + j]) { found = false; break; } } if (found) { return (uintptr_t)mbi.BaseAddress + i; } } } } currentAddress = (uintptr_t)mbi.BaseAddress + mbi.RegionSize; } } else { uintptr_t base = 0; size_t modSize = 0; if (!getModuleInfo(moduleName, base, modSize)) return 0; // Read module bytes std::vector buf(modSize); SIZE_T bytesRead = 0; if (!ReadProcessMemory(hProcess, (LPCVOID)base, buf.data(), modSize, &bytesRead)) return 0; for (size_t i = 0; i + patSize <= bytesRead; i++) { bool matched = true; for (size_t j = 0; j < patSize; j++) { if (!pat[j].wildcard && pat[j].value != buf[i + j]) { matched = false; break; } } if (matched) { return base + i; } } } return 0; } // Allocate memory near a specific address (±2GB) inline LPVOID allocNearAddress(uintptr_t addr, size_t sizeNeeded) { const size_t TWO_GB = (1ULL << 31); const size_t step = 0x10000; // 64KB uintptr_t start = (addr > TWO_GB) ? (addr - TWO_GB) : 0; uintptr_t end = addr + TWO_GB; auto alignDown = [&](uintptr_t x) { return (x / step) * step; }; start = alignDown(start); end = alignDown(end); for (uintptr_t curr = start; curr + sizeNeeded < end; curr += step) { LPVOID p = VirtualAllocEx( hProcess, (LPVOID)curr, sizeNeeded, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); if (p) { uintptr_t diff = (curr > addr) ? (curr - addr) : (addr - curr); if (diff <= TWO_GB) return p; VirtualFreeEx(hProcess, p, 0, MEM_RELEASE); } } return nullptr; } /*********************************************************************** * createBytePatch * - name: Unique string name, e.g., "NoCooldownPatch" * - pattern: AOB to search for * - patchOffset: Offset from the start of the pattern to begin patching * - newBytes: The vector of bytes to write * This function is for simple, in-place memory patches (like JNE -> JE). * It stores the original bytes and is automatically reversible * by the existing 'disableNamedHook' function. ***********************************************************************/ inline bool createBytePatch( const wchar_t *moduleName, const std::string &name, const std::vector &pattern, size_t patchOffset, const std::vector &newBytes) { // 1. Find pattern uintptr_t matchAddr = findPatternWild(moduleName, pattern); if (!matchAddr) { std::cerr << "[!] Could not find pattern for byte patch '" << name << "'.\n"; return false; } uintptr_t patchAddr = matchAddr + patchOffset; size_t overwriteLen = newBytes.size(); // 2. Read original bytes std::vector originalBytes(overwriteLen); if (!ReadProcessMemory(hProcess, (LPCVOID)patchAddr, originalBytes.data(), overwriteLen, nullptr)) { std::cerr << "[!] Failed to read original bytes for patch '" << name << "'.\n"; return false; } // 3. Write new bytes if (!WriteProcessMemory(hProcess, (LPVOID)patchAddr, newBytes.data(), overwriteLen, nullptr)) { std::cerr << "[!] WriteProcessMemory failed for patch '" << name << "'.\n"; return false; } FlushInstructionCache(hProcess, (LPCVOID)patchAddr, overwriteLen); // 4. Store HookInfo HookInfo hi; hi.hookName = name; hi.hookAddress = patchAddr; hi.overwriteLen = overwriteLen; hi.active = true; hi.originalBytes = originalBytes; hi.allocatedMem = nullptr; hi.allocSize = 0; hooks[name] = hi; std::cout << "[+] Byte patch '" << name << "' created at " << std::hex << patchAddr << std::dec << std::endl; return true; } /*********************************************************************** * createNamedHook * - name: Unique string name, e.g., "ArrowFrequency" * - pattern: e.g., {"0F", "28", "CE", "F3", "0F", "11", "73", "4C", ...} * with "??" for wildcards * - patternOffset: How far into that found pattern we actually place the hook * e.g., if the pattern is 12 bytes, but the instruction to hook starts at offset 3 * - overwriteLen: How many bytes we overwrite * - codeSize: How many bytes to allocate for code cave * - buildFunc: A lambda that, given the base address of the allocated block, * and the hookAddr where the original instruction started, * returns the final code bytes (which can also embed data). ***********************************************************************/ inline bool createNamedHook( const wchar_t *moduleName, const std::string &name, const std::vector &pattern, size_t patternOffset, size_t overwriteLen, size_t codeSize, std::function(uintptr_t codeCaveAddr, uintptr_t hookAddr, const std::vector &originalBytes)> buildFunc) { // A) Find pattern with wildcards uintptr_t matchAddr = findPatternWild(moduleName, pattern); if (!matchAddr) { std::cerr << "[!] Could not find pattern for hook '" << name << "'.\n"; return false; } // The actual instruction address is matchAddr + patternOffset uintptr_t hookAddr = matchAddr + patternOffset; // B) Read original bytes std::vector originalBytes(overwriteLen); if (!ReadProcessMemory(hProcess, (LPCVOID)hookAddr, originalBytes.data(), overwriteLen, nullptr)) { std::cerr << "[!] Failed to read original bytes for hook '" << name << "'.\n"; return false; } // C) Allocate near memory LPVOID nearMem = allocNearAddress(hookAddr, codeSize); if (!nearMem) { std::cerr << "[!] allocNearAddress failed for hook '" << name << "'.\n"; return false; } // D) Build injection code uintptr_t codeCaveAddr = reinterpret_cast(nearMem); std::vector code = buildFunc(codeCaveAddr, hookAddr, originalBytes); if (code.empty()) { std::cerr << "[!] buildFunc returned empty code for '" << name << "'.\n"; VirtualFreeEx(hProcess, nearMem, 0, MEM_RELEASE); return false; } // E) Write code to nearMem SIZE_T written = 0; if (!WriteProcessMemory(hProcess, nearMem, code.data(), code.size(), &written)) { std::cerr << "[!] WriteProcessMemory code failed for hook '" << name << "'.\n"; VirtualFreeEx(hProcess, nearMem, 0, MEM_RELEASE); return false; } FlushInstructionCache(hProcess, nearMem, code.size()); // F) Overwrite the original instructions with a JMP // If overwriteLen > 5, fill the rest with NOP std::vector patch(overwriteLen, 0x90); // Fill with NOP patch[0] = 0xE9; // JMP opcode int32_t rel = static_cast(reinterpret_cast(nearMem) - (hookAddr + 5)); std::memcpy(&patch[1], &rel, 4); if (!WriteProcessMemory(hProcess, reinterpret_cast(hookAddr), patch.data(), patch.size(), nullptr)) { std::cerr << "[!] Overwrite instruction failed for '" << name << "'.\n"; VirtualFreeEx(hProcess, nearMem, 0, MEM_RELEASE); return false; } FlushInstructionCache(hProcess, reinterpret_cast(hookAddr), patch.size()); // G) Store HookInfo HookInfo hi; hi.hookName = name; hi.hookAddress = hookAddr; hi.overwriteLen = overwriteLen; hi.active = true; hi.originalBytes = originalBytes; hi.allocatedMem = nearMem; hi.allocSize = codeSize; hooks[name] = hi; // Store in map by name std::cout << "[+] Hook '" << name << "' created at " << std::hex << hookAddr << std::dec << std::endl; return true; } inline bool createNamedHookByOffset( const wchar_t *moduleName, const std::string &name, uintptr_t offset, size_t overwriteLen, size_t codeSize, std::function(uintptr_t codeCaveAddr, uintptr_t hookAddr, const std::vector &originalBytes)> buildFunc) { uintptr_t modBase = 0; size_t modSize = 0; if (!getModuleInfo(moduleName, modBase, modSize)) { std::cerr << "[!] Could not find module for hook '" << name << "'.\n"; return false; } uintptr_t hookAddr = modBase + offset; // Read original bytes std::vector originalBytes(overwriteLen); if (!ReadProcessMemory(hProcess, (LPCVOID)hookAddr, originalBytes.data(), overwriteLen, nullptr)) { std::cerr << "[!] Failed to read original bytes for hook '" << name << "'.\n"; return false; } // Allocate near memory LPVOID nearMem = allocNearAddress(hookAddr, codeSize); if (!nearMem) return false; // Build injection code uintptr_t codeCaveAddr = reinterpret_cast(nearMem); std::vector code = buildFunc(codeCaveAddr, hookAddr, originalBytes); if (code.empty()) { VirtualFreeEx(hProcess, nearMem, 0, MEM_RELEASE); return false; } // Write code to nearMem SIZE_T written = 0; WriteProcessMemory(hProcess, nearMem, code.data(), code.size(), &written); FlushInstructionCache(hProcess, nearMem, code.size()); // Overwrite the original instructions with a JMP std::vector patch(overwriteLen, 0x90); patch[0] = 0xE9; int32_t rel = static_cast(codeCaveAddr - (hookAddr + 5)); std::memcpy(&patch[1], &rel, 4); WriteProcessMemory(hProcess, reinterpret_cast(hookAddr), patch.data(), patch.size(), nullptr); FlushInstructionCache(hProcess, reinterpret_cast(hookAddr), patch.size()); HookInfo hi; hi.hookName = name; hi.hookAddress = hookAddr; hi.overwriteLen = overwriteLen; hi.active = true; hi.originalBytes = originalBytes; hi.allocatedMem = nearMem; hi.allocSize = codeSize; hooks[name] = hi; std::cout << "[+] Hook '" << name << "' created at offset 0x" << std::hex << offset << std::dec << std::endl; return true; } /*********************************************************************** * createPointerToggle * - name: Unique string name, e.g., "HealthToggle" * - offsets: Pointer chain offsets to reach the target value * - desiredValue: The value to maintain at the target address * - valueType: (optional) Type hint for freezing current value ***********************************************************************/ template inline bool createPointerToggle( const wchar_t *moduleName, const std::string &name, const std::vector &offsets, const T desiredValue, const ValueType *typeHint = nullptr) { if (pointerToggles.find(name) != pointerToggles.end()) { std::cerr << "[!] Pointer toggle with name '" << name << "' already exists.\n"; return false; } // Resolve the address once uintptr_t targetAddr = resolveModuleDynamicAddress(moduleName, offsets); if (targetAddr == 0) { std::cerr << "[!] Failed to resolve address for pointer toggle '" << name << "'.\n"; return false; } // Create a shared_ptr for PointerToggleInfo auto pti = std::make_shared(); pti->toggleName = name; pti->offsets = offsets; pti->active = true; // Check if desiredValue is nullptr (freeze current value mode) if constexpr (std::is_same_v) { // Read current value from memory using the type hint size ValueType readValue{}; if (!ReadProcessMemory(hProcess, reinterpret_cast(targetAddr), &readValue, sizeof(ValueType), nullptr)) { std::cerr << "[!] Failed to read initial value for pointer toggle '" << name << "'.\n"; return false; } pti->desiredValue = readValue; pti->valueSize = sizeof(ValueType); } else { pti->desiredValue = desiredValue; pti->valueSize = sizeof(T); // Store the size of the desired value } // Insert into the map before starting the thread to ensure the pti remains valid pointerToggles[name] = pti; // Create a weak_ptr to avoid circular references std::weak_ptr weak_pti = pti; // Start a thread to continuously write the desired value pti->toggleThread = std::thread([this, weak_pti, targetAddr]() { // Attempt to lock the weak_ptr if (auto shared_pti = weak_pti.lock()) { while (shared_pti->active) { if (shared_pti->desiredValue.type() == typeid(BYTE)) { BYTE value = std::any_cast(shared_pti->desiredValue); WriteProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(BYTE), nullptr); } else if (shared_pti->desiredValue.type() == typeid(int)) { int value = std::any_cast(shared_pti->desiredValue); WriteProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(int), nullptr); } else if (shared_pti->desiredValue.type() == typeid(float)) { float value = std::any_cast(shared_pti->desiredValue); WriteProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(float), nullptr); } else if (shared_pti->desiredValue.type() == typeid(double)) { double value = std::any_cast(shared_pti->desiredValue); WriteProcessMemory(hProcess, reinterpret_cast(targetAddr), &value, sizeof(double), nullptr); } // Add more types as needed else { std::cerr << "[!] Unsupported type for toggle '" << shared_pti->toggleName << "'.\n"; } // Flush the instruction cache with the correct size FlushInstructionCache(hProcess, reinterpret_cast(targetAddr), shared_pti->valueSize); // Sleep for 10 milliseconds std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } else { std::cerr << "[!] PointerToggleInfo for toggle has been destroyed.\n"; } }); std::cout << "[+] Pointer toggle '" << name << "' activated.\n"; return true; } }; ================================================ FILE: Game Trainers/common/include/il2cpp/hook.h ================================================ #pragma once #include #include "memory.h" #include "MinHook.h" struct HOOK { void* target_func; void* detour_func; void* original_func; bool active; // Constructor matches usage in il2cpp.h HOOK(MEMORY mem, void* target, void* detour) { this->target_func = target; this->detour_func = detour; this->original_func = nullptr; this->active = false; // Ensure MinHook is initialized (safe to call multiple times) static bool initialized = false; if (!initialized) { MH_Initialize(); initialized = true; } } // Applies the hook void load() { if (MH_CreateHook(target_func, detour_func, &original_func) == MH_OK) { if (MH_EnableHook(target_func) == MH_OK) { active = true; } } } // Helper to get the original function pointer to call inside the hook template T get_original() { return (T)original_func; } // Destructor to clean up ~HOOK() { if (active) { MH_DisableHook(target_func); } } }; ================================================ FILE: Game Trainers/common/include/il2cpp/il2cpp.cpp ================================================ #include "il2cpp.h" namespace IL2CPP { Il2CppDomain* domain; namespace API { #define DO_API(r, n, p) IL2CPP_DECLARATION(n) #include IL2CPP_API_H #undef DO_API } bool Initialize(MEMORY memory) { void* game_assembly = memory.find_module("GameAssembly.dll"); if (!game_assembly) { printf("[!] CRITICAL: Could not find GameAssembly.dll module!\n"); return false; } #define DO_API(r, n, p) IL2CPP_FIND_FUNCTION(n) #include IL2CPP_API_H #undef DO_API domain = API::il2cpp_domain_get(); return true; } void Attach() { API::il2cpp_thread_attach(domain); } // ASSEMBLY Il2CppImage* ASSEMBLY::Image() { return this->image; } NAMESPACE* ASSEMBLY::Namespace(const char* namespace_name) { return new NAMESPACE(this, namespace_name); } ASSEMBLY* ASSEMBLY::List(size_t* size) { return (ASSEMBLY*)IL2CPP::API::il2cpp_domain_get_assemblies(domain, size); } // NAMESPACE NAMESPACE::NAMESPACE(ASSEMBLY* assembly_, const char* name_) { assembly = assembly_; name = name_; } CLASS* NAMESPACE::Class(const char* class_name) { return (CLASS*)API::il2cpp_class_from_name(assembly->Image(), name, class_name); } // CLASS TYPE* CLASS::Type(const char* field_name) { return Field(field_name)->Type(); } METHOD* CLASS::Method(const char* method_name, int args_count) { return (METHOD*)API::il2cpp_class_get_method_from_name(klass, method_name, args_count); }; FIELD* CLASS::Field(const char* field_name) { return (FIELD*)API::il2cpp_class_get_field_from_name(klass, field_name); } const char* CLASS::Name() { return IL2CPP::API::il2cpp_class_get_name(klass); } const char* CLASS::Namespaze() { return IL2CPP::API::il2cpp_class_get_namespace(klass); } const char* CLASS::AssemblyName() { return IL2CPP::API::il2cpp_class_get_assemblyname(klass); } const Il2CppImage* CLASS::Image() { return IL2CPP::API::il2cpp_class_get_image(klass); } // FIELD const char* FIELD::Name() { return IL2CPP::API::il2cpp_field_get_name(this); } TYPE* FIELD::Type() { return (TYPE*)API::il2cpp_field_get_type(this); } size_t FIELD::Offset() { return API::il2cpp_field_get_offset(this); } void FIELD::SetValue(OBJECT* obj, void* value) { API::il2cpp_field_set_value(obj, this, value); } void FIELD::SetStaticValue(void* value) { API::il2cpp_field_static_set_value(this, value); } OBJECT* FIELD::GetObject(OBJECT* obj) { return GetValue(obj); } ARRAY* FIELD::GetArray(OBJECT* obj) { return GetValue(obj); } STRING* FIELD::GetString(OBJECT* obj) { return GetValue(obj); } OBJECT* FIELD::GetStaticObject() { return GetStaticValue(); } ARRAY* FIELD::GetStaticArray() { return GetStaticValue(); } STRING* FIELD::GetStaticString() { return GetStaticValue(); } // Method const char* METHOD::Name() { return API::il2cpp_method_get_name(this); } // Type CLASS* TYPE::Class() { return (CLASS*)API::il2cpp_type_get_class_or_element_class(this); } const char* TYPE::Name() { return API::il2cpp_type_get_name(this); } // IL2CPP_OBJECT FIELD* OBJECT::Field(const char* field_name) { return Class()->Field(field_name); } OBJECT* OBJECT::GetObject(const char* field_name) { return Field(field_name)->GetObject(this); } ARRAY* OBJECT::GetArray(const char* field_name) { return Field(field_name)->GetArray(this); } STRING* OBJECT::GetString(const char* field_name) { return Field(field_name)->GetString(this); } CLASS* OBJECT::Class() { return (CLASS*)API::il2cpp_object_get_class(this); } TYPE* OBJECT::Type(const char* field_name) { return Field(field_name)->Type(); } void OBJECT::SetValue(const char* field_name, void* value) { Field(field_name)->SetValue(this, value); } // IL2CPP_ARRAY size_t ARRAY::MaxLength() { return this->max_length; } OBJECT* ARRAY::GetObject(size_t id) { return GetIndex(id); } STRING* ARRAY::GetString(size_t id) { return GetIndex(id); } const size_t STRING::Length() { return API::il2cpp_string_length(this); } const wchar_t* STRING::WChars() { return (wchar_t*)API::il2cpp_string_chars(this); } ASSEMBLY* Assembly(const char* assembly_name) { return (ASSEMBLY*)API::il2cpp_domain_assembly_open(domain, assembly_name); } STRING* String(const char* str){ return (STRING*)API::il2cpp_string_new(str); } CLASS* Class(const char* assembly_name, const char* namespace_name, const char* class_name) { return Assembly(assembly_name)->Namespace(namespace_name)->Class(class_name); } FIELD* Field(const char* assembly_name, const char* namespace_name, const char* class_name, const char* field_name) { return Class(assembly_name, namespace_name, class_name)->Field(field_name); } METHOD* Method(const char* assembly_name, const char* namespace_name, const char* class_name, const char* method_name, int param_count) { return Class(assembly_name, namespace_name, class_name)->Method(method_name, param_count); } } ================================================ FILE: Game Trainers/common/include/il2cpp/il2cpp.h ================================================ #pragma once #include "il2cpp_types.h" #define IL2CPP_API_H "il2cpp_api.h" #define IL2CPP_TYPEDEF(r, n, p) typedef r(__cdecl* n ## _t)p; #define IL2CPP_EXTERN_DECLARATION(n) extern n ## _t n; #define IL2CPP_DECLARATION(n) n ## _t n; #define IL2CPP_FIND_FUNCTION(n) API:: ## n = memory.find_function(game_assembly, #n); #define DO_API(r, n, p) IL2CPP_TYPEDEF(r, n, p); #include IL2CPP_API_H #undef DO_API #include "hook.h" namespace IL2CPP { extern Il2CppDomain* domain; bool Initialize(MEMORY memory); void Attach(); namespace API { #define DO_API(r, n, p) IL2CPP_EXTERN_DECLARATION(n) #include IL2CPP_API_H #undef DO_API } struct METHOD; struct STRING; struct ASSEMBLY; struct CLASS; struct FIELD; struct NAMESPACE; struct ARRAY; struct STRING; struct OBJECT; struct TYPE; struct METHOD : MethodInfo { const char* Name(); // Overload 1: Hook with original pointer return template HOOK* Hook(MEMORY memory, void* new_method, T* original) { auto new_hook = Hook(memory, new_method); *original = new_hook->get_original(); return new_hook; } // Overload 2: Hook without original pointer return template HOOK* Hook(MEMORY memory, void* new_method) { auto new_hook = new HOOK(memory, this->FindFunction(), new_method); new_hook->load(); return new_hook; } template T FindFunction() { return (T)this->methodPointer; } }; struct STRING : Il2CppString { const size_t Length(); const wchar_t* WChars(); }; struct ASSEMBLY : Il2CppAssembly { NAMESPACE* Namespace(const char* assembly_name); Il2CppImage* Image(); ASSEMBLY* List(size_t* size); }; struct NAMESPACE { NAMESPACE(ASSEMBLY* assembly_, const char* name_); CLASS* Class(const char* class_name); ASSEMBLY* assembly; const char* name; }; struct CLASS : Il2CppClass { TYPE* Type(const char* field_name); METHOD* Method(const char* method_name, int args_count = 0); //const MethodInfo* methods(void** iter); FIELD* Field(const char* field_name); //FieldInfo* fields(void** iter); const PropertyInfo* Property(const char* property_name); //const PropertyInfo* properties(void** iter); const char* Name(); const char* Namespaze(); const char* AssemblyName(); const Il2CppImage* Image(); }; struct FIELD : FieldInfo { const char* Name(); size_t Offset(); void SetValue(OBJECT* obj, void* value); void SetStaticValue(void* value); TYPE* Type(); template T GetValue(OBJECT* obj) { T ret; API::il2cpp_field_get_value(obj, this, &ret); return ret; }; template T GetStaticValue() { T ret; API::il2cpp_field_static_get_value(this, &ret); return ret; }; OBJECT* GetObject(OBJECT* obj); ARRAY* GetArray(OBJECT* obj); STRING* GetString(OBJECT* obj); OBJECT* GetStaticObject(); ARRAY* GetStaticArray(); STRING* GetStaticString(); }; struct TYPE : Il2CppType { CLASS* Class(); const char* Name(); }; struct OBJECT : Il2CppObject { FIELD* Field(const char* field_name); template T GetValue(const char* field_name) { return Field(field_name)->GetValue(this); }; ARRAY* GetArray(const char* field_name); STRING* GetString(const char* field_name); OBJECT* GetObject(const char* field_name); void SetValue(const char* field_name, void* value); CLASS* Class(); TYPE* Type(const char* field_name); }; struct ARRAY : Il2CppArray { size_t MaxLength(); template T* GetArray() { return (T*)((uintptr_t)this + sizeof(Il2CppArray)); } template T GetIndex(size_t id) { return GetArray()[id]; } OBJECT* GetObject(size_t id); STRING* GetString(size_t id); }; ASSEMBLY* Assembly(const char* name); NAMESPACE* Namespace(ASSEMBLY* assembly, const char* name); STRING* String(const char* str); CLASS* Class(const char* assembly_name, const char* namespace_name, const char* class_name); FIELD* Field(const char* assembly_name, const char* namespace_name, const char* class_name, const char* field_name); METHOD* Method(const char* assembly_name, const char* namespace_name, const char* class_name, const char* method_name, int param_count); template T Function(const char* assembly_name, const char* namespace_name, const char* klass_name, const char* method_name, int param_count) { return Method(assembly_name, namespace_name, klass_name, method_name, param_count)->FindFunction(); } }; ================================================ FILE: Game Trainers/common/include/il2cpp/il2cpp_api.h ================================================ #ifndef DO_API_NO_RETURN #define DO_API_NO_RETURN(r, n, p) DO_API(r,n,p) #endif DO_API(void, il2cpp_init, (const char* domain_name)); DO_API(void, il2cpp_init_utf16, (const Il2CppChar* domain_name)); DO_API(void, il2cpp_shutdown, ()); DO_API(void, il2cpp_dumping_memory, (bool val)); DO_API(void, il2cpp_set_config_dir, (const char* config_path)); DO_API(void, il2cpp_set_data_dir, (const char* data_path)); DO_API(void, il2cpp_set_temp_dir, (const char* temp_path)); DO_API(void, il2cpp_set_commandline_arguments, (int argc, const char* const argv[], const char* basedir)); DO_API(void, il2cpp_set_commandline_arguments_utf16, (int argc, const Il2CppChar* const argv[], const char* basedir)); DO_API(void, il2cpp_set_config_utf16, (const Il2CppChar* executablePath)); DO_API(void, il2cpp_set_config, (const char* executablePath)); DO_API(void, il2cpp_set_memory_callbacks, (Il2CppMemoryCallbacks* callbacks)); DO_API(const Il2CppImage*, il2cpp_get_corlib, ()); DO_API(void, il2cpp_add_internal_call, (const char* name, Il2CppMethodPointer method)); DO_API(Il2CppMethodPointer, il2cpp_resolve_icall, (const char* name)); DO_API(void*, il2cpp_alloc, (size_t size)); DO_API(void, il2cpp_free, (void* ptr)); // array DO_API(Il2CppClass*, il2cpp_array_class_get, (Il2CppClass* element_class, uint32_t rank)); DO_API(uint32_t, il2cpp_array_length, (Il2CppArray* array)); DO_API(uint32_t, il2cpp_array_get_byte_length, (Il2CppArray* array)); DO_API(Il2CppArray*, il2cpp_array_new, (Il2CppClass* elementTypeInfo, il2cpp_array_size_t length)); DO_API(Il2CppArray*, il2cpp_array_new_specific, (Il2CppClass* arrayTypeInfo, il2cpp_array_size_t length)); DO_API(Il2CppArray*, il2cpp_array_new_full, (Il2CppClass* array_class, il2cpp_array_size_t* lengths, il2cpp_array_size_t* lower_bounds)); DO_API(Il2CppClass*, il2cpp_bounded_array_class_get, (Il2CppClass* element_class, uint32_t rank, bool bounded)); DO_API(int, il2cpp_array_element_size, (const Il2CppClass* array_class)); // assembly DO_API(const Il2CppImage*, il2cpp_assembly_get_image, (const Il2CppAssembly* assembly)); // class DO_API(const Il2CppType*, il2cpp_class_enum_basetype, (Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_generic, (const Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_inflated, (const Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_assignable_from, (Il2CppClass* klass, Il2CppClass* oklass)); DO_API(bool, il2cpp_class_is_subclass_of, (Il2CppClass* klass, Il2CppClass* klassc, bool check_interfaces)); DO_API(bool, il2cpp_class_has_parent, (Il2CppClass* klass, Il2CppClass* klassc)); DO_API(Il2CppClass*, il2cpp_class_from_il2cpp_type, (const Il2CppType* type)); DO_API(Il2CppClass*, il2cpp_class_from_name, (const Il2CppImage* image, const char* namespaze, const char* name)); DO_API(Il2CppClass*, il2cpp_class_from_system_type, (Il2CppReflectionType* type)); DO_API(Il2CppClass*, il2cpp_class_get_element_class, (Il2CppClass* klass)); DO_API(const EventInfo*, il2cpp_class_get_events, (Il2CppClass* klass, void** iter)); DO_API(FieldInfo*, il2cpp_class_get_fields, (Il2CppClass* klass, void** iter)); DO_API(Il2CppClass*, il2cpp_class_get_nested_types, (Il2CppClass* klass, void** iter)); DO_API(Il2CppClass*, il2cpp_class_get_interfaces, (Il2CppClass* klass, void** iter)); DO_API(const PropertyInfo*, il2cpp_class_get_properties, (Il2CppClass* klass, void** iter)); DO_API(const PropertyInfo*, il2cpp_class_get_property_from_name, (Il2CppClass* klass, const char* name)); DO_API(FieldInfo*, il2cpp_class_get_field_from_name, (Il2CppClass* klass, const char* name)); DO_API(const MethodInfo*, il2cpp_class_get_methods, (Il2CppClass* klass, void** iter)); DO_API(const MethodInfo*, il2cpp_class_get_method_from_name, (Il2CppClass* klass, const char* name, int argsCount)); DO_API(const char*, il2cpp_class_get_name, (Il2CppClass* klass)); DO_API(const char*, il2cpp_class_get_namespace, (Il2CppClass* klass)); DO_API(Il2CppClass*, il2cpp_class_get_parent, (Il2CppClass* klass)); DO_API(Il2CppClass*, il2cpp_class_get_declaring_type, (Il2CppClass* klass)); DO_API(int32_t, il2cpp_class_instance_size, (Il2CppClass* klass)); DO_API(size_t, il2cpp_class_num_fields, (const Il2CppClass* enumKlass)); DO_API(bool, il2cpp_class_is_valuetype, (const Il2CppClass* klass)); DO_API(int32_t, il2cpp_class_value_size, (Il2CppClass* klass, uint32_t* align)); DO_API(bool, il2cpp_class_is_blittable, (const Il2CppClass* klass)); DO_API(int, il2cpp_class_get_flags, (const Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_abstract, (const Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_interface, (const Il2CppClass* klass)); DO_API(int, il2cpp_class_array_element_size, (const Il2CppClass* klass)); DO_API(Il2CppClass*, il2cpp_class_from_type, (const Il2CppType* type)); DO_API(const Il2CppType*, il2cpp_class_get_type, (Il2CppClass* klass)); DO_API(uint32_t, il2cpp_class_get_type_token, (Il2CppClass* klass)); DO_API(bool, il2cpp_class_has_attribute, (Il2CppClass* klass, Il2CppClass* attr_class)); DO_API(bool, il2cpp_class_has_references, (Il2CppClass* klass)); DO_API(bool, il2cpp_class_is_enum, (const Il2CppClass* klass)); DO_API(const Il2CppImage*, il2cpp_class_get_image, (Il2CppClass* klass)); DO_API(const char*, il2cpp_class_get_assemblyname, (const Il2CppClass* klass)); DO_API(int, il2cpp_class_get_rank, (const Il2CppClass* klass)); // testing only DO_API(size_t, il2cpp_class_get_bitmap_size, (const Il2CppClass* klass)); DO_API(void, il2cpp_class_get_bitmap, (Il2CppClass* klass, size_t* bitmap)); // stats DO_API(bool, il2cpp_stats_dump_to_file, (const char* path)); DO_API(uint64_t, il2cpp_stats_get_value, (Il2CppStat stat)); // domain DO_API(Il2CppDomain*, il2cpp_domain_get, ()); DO_API(const Il2CppAssembly*, il2cpp_domain_assembly_open, (Il2CppDomain* domain, const char* name)); DO_API(const Il2CppAssembly**, il2cpp_domain_get_assemblies, (const Il2CppDomain* domain, size_t* size)); // exception DO_API_NO_RETURN(void, il2cpp_raise_exception, (Il2CppException*)); DO_API(Il2CppException*, il2cpp_exception_from_name_msg, (const Il2CppImage* image, const char* name_space, const char* name, const char* msg)); DO_API(Il2CppException*, il2cpp_get_exception_argument_null, (const char* arg)); DO_API(void, il2cpp_format_exception, (const Il2CppException* ex, char* message, int message_size)); DO_API(void, il2cpp_format_stack_trace, (const Il2CppException* ex, char* output, int output_size)); DO_API(void, il2cpp_unhandled_exception, (Il2CppException*)); // field DO_API(int, il2cpp_field_get_flags, (FieldInfo* field)); DO_API(const char*, il2cpp_field_get_name, (FieldInfo* field)); DO_API(Il2CppClass*, il2cpp_field_get_parent, (FieldInfo* field)); DO_API(size_t, il2cpp_field_get_offset, (FieldInfo* field)); DO_API(const Il2CppType*, il2cpp_field_get_type, (FieldInfo* field)); DO_API(void, il2cpp_field_get_value, (Il2CppObject* obj, FieldInfo* field, void* value)); DO_API(Il2CppObject*, il2cpp_field_get_value_object, (FieldInfo* field, Il2CppObject* obj)); DO_API(bool, il2cpp_field_has_attribute, (FieldInfo* field, Il2CppClass* attr_class)); DO_API(void, il2cpp_field_set_value, (Il2CppObject* obj, FieldInfo* field, void* value)); DO_API(void, il2cpp_field_static_get_value, (FieldInfo* field, void* value)); DO_API(void, il2cpp_field_static_set_value, (FieldInfo* field, void* value)); DO_API(void, il2cpp_field_set_value_object, (Il2CppObject* instance, FieldInfo* field, Il2CppObject* value)); // gc DO_API(void, il2cpp_gc_collect, (int maxGenerations)); DO_API(int32_t, il2cpp_gc_collect_a_little, ()); DO_API(void, il2cpp_gc_disable, ()); DO_API(void, il2cpp_gc_enable, ()); DO_API(bool, il2cpp_gc_is_disabled, ()); DO_API(int64_t, il2cpp_gc_get_used_size, ()); DO_API(int64_t, il2cpp_gc_get_heap_size, ()); DO_API(void, il2cpp_gc_wbarrier_set_field, (Il2CppObject* obj, void** targetAddress, void* object)); // gchandle DO_API(uint32_t, il2cpp_gchandle_new, (Il2CppObject* obj, bool pinned)); DO_API(uint32_t, il2cpp_gchandle_new_weakref, (Il2CppObject* obj, bool track_resurrection)); DO_API(Il2CppObject*, il2cpp_gchandle_get_target, (uint32_t gchandle)); DO_API(void, il2cpp_gchandle_free, (uint32_t gchandle)); // liveness DO_API(void*, il2cpp_unity_liveness_calculation_begin, (Il2CppClass* filter, int max_object_count, il2cpp_register_object_callback callback, void* userdata, il2cpp_WorldChangedCallback onWorldStarted, il2cpp_WorldChangedCallback onWorldStopped)); DO_API(void, il2cpp_unity_liveness_calculation_end, (void* state)); DO_API(void, il2cpp_unity_liveness_calculation_from_root, (Il2CppObject* root, void* state)); DO_API(void, il2cpp_unity_liveness_calculation_from_statics, (void* state)); // method DO_API(const Il2CppType*, il2cpp_method_get_return_type, (const MethodInfo* method)); DO_API(Il2CppClass*, il2cpp_method_get_declaring_type, (const MethodInfo* method)); DO_API(const char*, il2cpp_method_get_name, (const MethodInfo* method)); DO_API(const MethodInfo*, il2cpp_method_get_from_reflection, (const Il2CppReflectionMethod* method)); DO_API(Il2CppReflectionMethod*, il2cpp_method_get_object, (const MethodInfo* method, Il2CppClass* refclass)); DO_API(bool, il2cpp_method_is_generic, (const MethodInfo* method)); DO_API(bool, il2cpp_method_is_inflated, (const MethodInfo* method)); DO_API(bool, il2cpp_method_is_instance, (const MethodInfo* method)); DO_API(uint32_t, il2cpp_method_get_param_count, (const MethodInfo* method)); DO_API(const Il2CppType*, il2cpp_method_get_param, (const MethodInfo* method, uint32_t index)); DO_API(Il2CppClass*, il2cpp_method_get_class, (const MethodInfo* method)); DO_API(bool, il2cpp_method_has_attribute, (const MethodInfo* method, Il2CppClass* attr_class)); DO_API(uint32_t, il2cpp_method_get_flags, (const MethodInfo* method, uint32_t* iflags)); DO_API(uint32_t, il2cpp_method_get_token, (const MethodInfo* method)); DO_API(const char*, il2cpp_method_get_param_name, (const MethodInfo* method, uint32_t index)); // profiler #if IL2CPP_ENABLE_PROFILER DO_API(void, il2cpp_profiler_install, (Il2CppProfiler* prof, Il2CppProfileFunc shutdown_callback)); DO_API(void, il2cpp_profiler_set_events, (Il2CppProfileFlags events)); DO_API(void, il2cpp_profiler_install_enter_leave, (Il2CppProfileMethodFunc enter, Il2CppProfileMethodFunc fleave)); DO_API(void, il2cpp_profiler_install_allocation, (Il2CppProfileAllocFunc callback)); DO_API(void, il2cpp_profiler_install_gc, (Il2CppProfileGCFunc callback, Il2CppProfileGCResizeFunc heap_resize_callback)); DO_API(void, il2cpp_profiler_install_fileio, (Il2CppProfileFileIOFunc callback)); DO_API(void, il2cpp_profiler_install_thread, (Il2CppProfileThreadFunc start, Il2CppProfileThreadFunc end)); #endif // property DO_API(uint32_t, il2cpp_property_get_flags, (PropertyInfo* prop)); DO_API(const MethodInfo*, il2cpp_property_get_get_method, (PropertyInfo* prop)); DO_API(const MethodInfo*, il2cpp_property_get_set_method, (PropertyInfo* prop)); DO_API(const char*, il2cpp_property_get_name, (PropertyInfo* prop)); DO_API(Il2CppClass*, il2cpp_property_get_parent, (PropertyInfo* prop)); // object DO_API(Il2CppClass*, il2cpp_object_get_class, (Il2CppObject* obj)); DO_API(uint32_t, il2cpp_object_get_size, (Il2CppObject* obj)); DO_API(const MethodInfo*, il2cpp_object_get_virtual_method, (Il2CppObject* obj, const MethodInfo* method)); DO_API(Il2CppObject*, il2cpp_object_new, (const Il2CppClass* klass)); DO_API(void*, il2cpp_object_unbox, (Il2CppObject* obj)); DO_API(Il2CppObject*, il2cpp_value_box, (Il2CppClass* klass, void* data)); // monitor DO_API(void, il2cpp_monitor_enter, (Il2CppObject* obj)); DO_API(bool, il2cpp_monitor_try_enter, (Il2CppObject* obj, uint32_t timeout)); DO_API(void, il2cpp_monitor_exit, (Il2CppObject* obj)); DO_API(void, il2cpp_monitor_pulse, (Il2CppObject* obj)); DO_API(void, il2cpp_monitor_pulse_all, (Il2CppObject* obj)); DO_API(void, il2cpp_monitor_wait, (Il2CppObject* obj)); DO_API(bool, il2cpp_monitor_try_wait, (Il2CppObject* obj, uint32_t timeout)); // runtime DO_API(Il2CppObject*, il2cpp_runtime_invoke, (const MethodInfo* method, void* obj, void** params, Il2CppException** exc)); DO_API(Il2CppObject*, il2cpp_runtime_invoke_convert_args, (const MethodInfo* method, void* obj, Il2CppObject** params, int paramCount, Il2CppException** exc)); DO_API(void, il2cpp_runtime_class_init, (Il2CppClass* klass)); DO_API(void, il2cpp_runtime_object_init, (Il2CppObject* obj)); DO_API(void, il2cpp_runtime_object_init_exception, (Il2CppObject* obj, Il2CppException** exc)); DO_API(void, il2cpp_runtime_unhandled_exception_policy_set, (Il2CppRuntimeUnhandledExceptionPolicy value)); // string DO_API(int32_t, il2cpp_string_length, (Il2CppString* str)); DO_API(Il2CppChar*, il2cpp_string_chars, (Il2CppString* str)); DO_API(Il2CppString*, il2cpp_string_new, (const char* str)); DO_API(Il2CppString*, il2cpp_string_new_len, (const char* str, uint32_t length)); DO_API(Il2CppString*, il2cpp_string_new_utf16, (const Il2CppChar* text, int32_t len)); DO_API(Il2CppString*, il2cpp_string_new_wrapper, (const char* str)); DO_API(Il2CppString*, il2cpp_string_intern, (Il2CppString* str)); DO_API(Il2CppString*, il2cpp_string_is_interned, (Il2CppString* str)); // thread DO_API(Il2CppThread*, il2cpp_thread_current, ()); DO_API(Il2CppThread*, il2cpp_thread_attach, (Il2CppDomain* domain)); DO_API(void, il2cpp_thread_detach, (Il2CppThread* thread)); DO_API(Il2CppThread**, il2cpp_thread_get_all_attached_threads, (size_t* size)); DO_API(bool, il2cpp_is_vm_thread, (Il2CppThread* thread)); // stacktrace DO_API(void, il2cpp_current_thread_walk_frame_stack, (Il2CppFrameWalkFunc func, void* user_data)); DO_API(void, il2cpp_thread_walk_frame_stack, (Il2CppThread* thread, Il2CppFrameWalkFunc func, void* user_data)); DO_API(bool, il2cpp_current_thread_get_top_frame, (Il2CppStackFrameInfo* frame)); DO_API(bool, il2cpp_thread_get_top_frame, (Il2CppThread* thread, Il2CppStackFrameInfo* frame)); DO_API(bool, il2cpp_current_thread_get_frame_at, (int32_t offset, Il2CppStackFrameInfo* frame)); DO_API(bool, il2cpp_thread_get_frame_at, (Il2CppThread* thread, int32_t offset, Il2CppStackFrameInfo* frame)); DO_API(int32_t, il2cpp_current_thread_get_stack_depth, ()); DO_API(int32_t, il2cpp_thread_get_stack_depth, (Il2CppThread* thread)); // type DO_API(Il2CppObject*, il2cpp_type_get_object, (const Il2CppType* type)); DO_API(int, il2cpp_type_get_type, (const Il2CppType* type)); DO_API(Il2CppClass*, il2cpp_type_get_class_or_element_class, (const Il2CppType* type)); DO_API(char*, il2cpp_type_get_name, (const Il2CppType* type)); DO_API(bool, il2cpp_type_is_byref, (const Il2CppType* type)); DO_API(uint32_t, il2cpp_type_get_attrs, (const Il2CppType* type)); DO_API(bool, il2cpp_type_equals, (const Il2CppType* type, const Il2CppType* otherType)); DO_API(char*, il2cpp_type_get_assembly_qualified_name, (const Il2CppType* type)); // image DO_API(const Il2CppAssembly*, il2cpp_image_get_assembly, (const Il2CppImage* image)); DO_API(const char*, il2cpp_image_get_name, (const Il2CppImage* image)); DO_API(const char*, il2cpp_image_get_filename, (const Il2CppImage* image)); DO_API(const MethodInfo*, il2cpp_image_get_entry_point, (const Il2CppImage* image)); DO_API(size_t, il2cpp_image_get_class_count, (const Il2CppImage* image)); DO_API(const Il2CppClass*, il2cpp_image_get_class, (const Il2CppImage* image, size_t index)); // Memory information DO_API(Il2CppManagedMemorySnapshot*, il2cpp_capture_memory_snapshot, ()); DO_API(void, il2cpp_free_captured_memory_snapshot, (Il2CppManagedMemorySnapshot* snapshot)); DO_API(void, il2cpp_set_find_plugin_callback, (Il2CppSetFindPlugInCallback method)); // Logging DO_API(void, il2cpp_register_log_callback, (Il2CppLogCallback method)); // Debugger DO_API(void, il2cpp_debugger_set_agent_options, (const char* options)); DO_API(bool, il2cpp_is_debugger_attached, ()); // TLS module DO_API(void, il2cpp_unity_install_unitytls_interface, (const void* unitytlsInterfaceStruct)); // custom attributes DO_API(Il2CppCustomAttrInfo*, il2cpp_custom_attrs_from_class, (Il2CppClass* klass)); DO_API(Il2CppCustomAttrInfo*, il2cpp_custom_attrs_from_method, (const MethodInfo* method)); DO_API(Il2CppObject*, il2cpp_custom_attrs_get_attr, (Il2CppCustomAttrInfo* ainfo, Il2CppClass* attr_klass)); DO_API(bool, il2cpp_custom_attrs_has_attr, (Il2CppCustomAttrInfo* ainfo, Il2CppClass* attr_klass)); DO_API(Il2CppArray*, il2cpp_custom_attrs_construct, (Il2CppCustomAttrInfo* cinfo)); DO_API(void, il2cpp_custom_attrs_free, (Il2CppCustomAttrInfo* ainfo)); ================================================ FILE: Game Trainers/common/include/il2cpp/il2cpp_types.h ================================================ #include #pragma once /* * Field Attributes (21.1.5). */ #define FIELD_ATTRIBUTE_FIELD_ACCESS_MASK 0x0007 #define FIELD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000 #define FIELD_ATTRIBUTE_PRIVATE 0x0001 #define FIELD_ATTRIBUTE_FAM_AND_ASSEM 0x0002 #define FIELD_ATTRIBUTE_ASSEMBLY 0x0003 #define FIELD_ATTRIBUTE_FAMILY 0x0004 #define FIELD_ATTRIBUTE_FAM_OR_ASSEM 0x0005 #define FIELD_ATTRIBUTE_PUBLIC 0x0006 #define FIELD_ATTRIBUTE_STATIC 0x0010 #define FIELD_ATTRIBUTE_INIT_ONLY 0x0020 #define FIELD_ATTRIBUTE_LITERAL 0x0040 #define FIELD_ATTRIBUTE_NOT_SERIALIZED 0x0080 #define FIELD_ATTRIBUTE_SPECIAL_NAME 0x0200 #define FIELD_ATTRIBUTE_PINVOKE_IMPL 0x2000 /* For runtime use only */ #define FIELD_ATTRIBUTE_RESERVED_MASK 0x9500 #define FIELD_ATTRIBUTE_RT_SPECIAL_NAME 0x0400 #define FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL 0x1000 #define FIELD_ATTRIBUTE_HAS_DEFAULT 0x8000 #define FIELD_ATTRIBUTE_HAS_FIELD_RVA 0x0100 /* * Method Attributes (22.1.9) */ #define METHOD_IMPL_ATTRIBUTE_CODE_TYPE_MASK 0x0003 #define METHOD_IMPL_ATTRIBUTE_IL 0x0000 #define METHOD_IMPL_ATTRIBUTE_NATIVE 0x0001 #define METHOD_IMPL_ATTRIBUTE_OPTIL 0x0002 #define METHOD_IMPL_ATTRIBUTE_RUNTIME 0x0003 #define METHOD_IMPL_ATTRIBUTE_MANAGED_MASK 0x0004 #define METHOD_IMPL_ATTRIBUTE_UNMANAGED 0x0004 #define METHOD_IMPL_ATTRIBUTE_MANAGED 0x0000 #define METHOD_IMPL_ATTRIBUTE_FORWARD_REF 0x0010 #define METHOD_IMPL_ATTRIBUTE_PRESERVE_SIG 0x0080 #define METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL 0x1000 #define METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED 0x0020 #define METHOD_IMPL_ATTRIBUTE_NOINLINING 0x0008 #define METHOD_IMPL_ATTRIBUTE_MAX_METHOD_IMPL_VAL 0xffff #define METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK 0x0007 #define METHOD_ATTRIBUTE_COMPILER_CONTROLLED 0x0000 #define METHOD_ATTRIBUTE_PRIVATE 0x0001 #define METHOD_ATTRIBUTE_FAM_AND_ASSEM 0x0002 #define METHOD_ATTRIBUTE_ASSEM 0x0003 #define METHOD_ATTRIBUTE_FAMILY 0x0004 #define METHOD_ATTRIBUTE_FAM_OR_ASSEM 0x0005 #define METHOD_ATTRIBUTE_PUBLIC 0x0006 #define METHOD_ATTRIBUTE_STATIC 0x0010 #define METHOD_ATTRIBUTE_FINAL 0x0020 #define METHOD_ATTRIBUTE_VIRTUAL 0x0040 #define METHOD_ATTRIBUTE_HIDE_BY_SIG 0x0080 #define METHOD_ATTRIBUTE_VTABLE_LAYOUT_MASK 0x0100 #define METHOD_ATTRIBUTE_REUSE_SLOT 0x0000 #define METHOD_ATTRIBUTE_NEW_SLOT 0x0100 #define METHOD_ATTRIBUTE_STRICT 0x0200 #define METHOD_ATTRIBUTE_ABSTRACT 0x0400 #define METHOD_ATTRIBUTE_SPECIAL_NAME 0x0800 #define METHOD_ATTRIBUTE_PINVOKE_IMPL 0x2000 #define METHOD_ATTRIBUTE_UNMANAGED_EXPORT 0x0008 /* * For runtime use only */ #define METHOD_ATTRIBUTE_RESERVED_MASK 0xd000 #define METHOD_ATTRIBUTE_RT_SPECIAL_NAME 0x1000 #define METHOD_ATTRIBUTE_HAS_SECURITY 0x4000 #define METHOD_ATTRIBUTE_REQUIRE_SEC_OBJECT 0x8000 /* * Type Attributes (21.1.13). */ #define TYPE_ATTRIBUTE_VISIBILITY_MASK 0x00000007 #define TYPE_ATTRIBUTE_NOT_PUBLIC 0x00000000 #define TYPE_ATTRIBUTE_PUBLIC 0x00000001 #define TYPE_ATTRIBUTE_NESTED_PUBLIC 0x00000002 #define TYPE_ATTRIBUTE_NESTED_PRIVATE 0x00000003 #define TYPE_ATTRIBUTE_NESTED_FAMILY 0x00000004 #define TYPE_ATTRIBUTE_NESTED_ASSEMBLY 0x00000005 #define TYPE_ATTRIBUTE_NESTED_FAM_AND_ASSEM 0x00000006 #define TYPE_ATTRIBUTE_NESTED_FAM_OR_ASSEM 0x00000007 #define TYPE_ATTRIBUTE_LAYOUT_MASK 0x00000018 #define TYPE_ATTRIBUTE_AUTO_LAYOUT 0x00000000 #define TYPE_ATTRIBUTE_SEQUENTIAL_LAYOUT 0x00000008 #define TYPE_ATTRIBUTE_EXPLICIT_LAYOUT 0x00000010 #define TYPE_ATTRIBUTE_CLASS_SEMANTIC_MASK 0x00000020 #define TYPE_ATTRIBUTE_CLASS 0x00000000 #define TYPE_ATTRIBUTE_INTERFACE 0x00000020 #define TYPE_ATTRIBUTE_ABSTRACT 0x00000080 #define TYPE_ATTRIBUTE_SEALED 0x00000100 #define TYPE_ATTRIBUTE_SPECIAL_NAME 0x00000400 #define TYPE_ATTRIBUTE_IMPORT 0x00001000 #define TYPE_ATTRIBUTE_SERIALIZABLE 0x00002000 #define TYPE_ATTRIBUTE_STRING_FORMAT_MASK 0x00030000 #define TYPE_ATTRIBUTE_ANSI_CLASS 0x00000000 #define TYPE_ATTRIBUTE_UNICODE_CLASS 0x00010000 #define TYPE_ATTRIBUTE_AUTO_CLASS 0x00020000 #define TYPE_ATTRIBUTE_BEFORE_FIELD_INIT 0x00100000 #define TYPE_ATTRIBUTE_FORWARDER 0x00200000 #define TYPE_ATTRIBUTE_RESERVED_MASK 0x00040800 #define TYPE_ATTRIBUTE_RT_SPECIAL_NAME 0x00000800 #define TYPE_ATTRIBUTE_HAS_SECURITY 0x00040000 /* * Flags for Params (22.1.12) */ #define PARAM_ATTRIBUTE_IN 0x0001 #define PARAM_ATTRIBUTE_OUT 0x0002 #define PARAM_ATTRIBUTE_OPTIONAL 0x0010 #define PARAM_ATTRIBUTE_RESERVED_MASK 0xf000 #define PARAM_ATTRIBUTE_HAS_DEFAULT 0x1000 #define PARAM_ATTRIBUTE_HAS_FIELD_MARSHAL 0x2000 #define PARAM_ATTRIBUTE_UNUSED 0xcfe0 // Flags for Generic Parameters (II.23.1.7) #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_NON_VARIANT 0x00 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_COVARIANT 0x01 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT 0x02 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK 0x03 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT 0x04 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_NOT_NULLABLE_VALUE_TYPE_CONSTRAINT 0x08 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_DEFAULT_CONSTRUCTOR_CONSTRAINT 0x10 #define IL2CPP_GENERIC_PARAMETER_ATTRIBUTE_SPECIAL_CONSTRAINT_MASK 0x1C /** * 21.5 AssemblyRefs */ #define ASSEMBLYREF_FULL_PUBLIC_KEY_FLAG 0x00000001 #define ASSEMBLYREF_RETARGETABLE_FLAG 0x00000100 #define ASSEMBLYREF_ENABLEJITCOMPILE_TRACKING_FLAG 0x00008000 #define ASSEMBLYREF_DISABLEJITCOMPILE_OPTIMIZER_FLAG 0x00004000 typedef struct Il2CppClass Il2CppClass; typedef struct Il2CppType Il2CppType; typedef struct EventInfo EventInfo; typedef struct MethodInfo MethodInfo; typedef struct FieldInfo FieldInfo; typedef struct PropertyInfo PropertyInfo; typedef struct Il2CppAssembly Il2CppAssembly; typedef struct Il2CppArray Il2CppArray; typedef struct Il2CppDelegate Il2CppDelegate; typedef struct Il2CppDomain Il2CppDomain; typedef struct Il2CppImage Il2CppImage; typedef struct Il2CppException Il2CppException; typedef struct Il2CppProfiler Il2CppProfiler; typedef struct Il2CppObject Il2CppObject; typedef struct Il2CppReflectionMethod Il2CppReflectionMethod; typedef struct Il2CppReflectionType Il2CppReflectionType; typedef struct Il2CppString Il2CppString; typedef struct Il2CppThread Il2CppThread; typedef struct Il2CppAsyncResult Il2CppAsyncResult; typedef struct Il2CppManagedMemorySnapshot Il2CppManagedMemorySnapshot; typedef struct Il2CppCustomAttrInfo Il2CppCustomAttrInfo; typedef enum { IL2CPP_PROFILE_NONE = 0, IL2CPP_PROFILE_APPDOMAIN_EVENTS = 1 << 0, IL2CPP_PROFILE_ASSEMBLY_EVENTS = 1 << 1, IL2CPP_PROFILE_MODULE_EVENTS = 1 << 2, IL2CPP_PROFILE_CLASS_EVENTS = 1 << 3, IL2CPP_PROFILE_JIT_COMPILATION = 1 << 4, IL2CPP_PROFILE_INLINING = 1 << 5, IL2CPP_PROFILE_EXCEPTIONS = 1 << 6, IL2CPP_PROFILE_ALLOCATIONS = 1 << 7, IL2CPP_PROFILE_GC = 1 << 8, IL2CPP_PROFILE_THREADS = 1 << 9, IL2CPP_PROFILE_REMOTING = 1 << 10, IL2CPP_PROFILE_TRANSITIONS = 1 << 11, IL2CPP_PROFILE_ENTER_LEAVE = 1 << 12, IL2CPP_PROFILE_COVERAGE = 1 << 13, IL2CPP_PROFILE_INS_COVERAGE = 1 << 14, IL2CPP_PROFILE_STATISTICAL = 1 << 15, IL2CPP_PROFILE_METHOD_EVENTS = 1 << 16, IL2CPP_PROFILE_MONITOR_EVENTS = 1 << 17, IL2CPP_PROFILE_IOMAP_EVENTS = 1 << 18, IL2CPP_PROFILE_GC_MOVES = 1 << 19, IL2CPP_PROFILE_FILEIO = 1 << 20 } Il2CppProfileFlags; typedef enum { IL2CPP_PROFILE_FILEIO_WRITE = 0, IL2CPP_PROFILE_FILEIO_READ } Il2CppProfileFileIOKind; typedef enum { IL2CPP_GC_EVENT_START, IL2CPP_GC_EVENT_MARK_START, IL2CPP_GC_EVENT_MARK_END, IL2CPP_GC_EVENT_RECLAIM_START, IL2CPP_GC_EVENT_RECLAIM_END, IL2CPP_GC_EVENT_END, IL2CPP_GC_EVENT_PRE_STOP_WORLD, IL2CPP_GC_EVENT_POST_STOP_WORLD, IL2CPP_GC_EVENT_PRE_START_WORLD, IL2CPP_GC_EVENT_POST_START_WORLD } Il2CppGCEvent; typedef enum { IL2CPP_STAT_NEW_OBJECT_COUNT, IL2CPP_STAT_INITIALIZED_CLASS_COUNT, IL2CPP_STAT_METHOD_COUNT, IL2CPP_STAT_CLASS_STATIC_DATA_SIZE, IL2CPP_STAT_GENERIC_INSTANCE_COUNT, IL2CPP_STAT_GENERIC_CLASS_COUNT, IL2CPP_STAT_INFLATED_METHOD_COUNT, IL2CPP_STAT_INFLATED_TYPE_COUNT, } Il2CppStat; typedef enum { IL2CPP_UNHANDLED_POLICY_LEGACY, IL2CPP_UNHANDLED_POLICY_CURRENT } Il2CppRuntimeUnhandledExceptionPolicy; typedef struct Il2CppStackFrameInfo { const MethodInfo* method; } Il2CppStackFrameInfo; typedef void(*Il2CppMethodPointer)(); typedef struct Il2CppMethodDebugInfo { Il2CppMethodPointer methodPointer; int32_t code_size; const char* file; } Il2CppMethodDebugInfo; typedef struct { void* (*malloc_func)(size_t size); void* (*aligned_malloc_func)(size_t size, size_t alignment); void (*free_func)(void* ptr); void (*aligned_free_func)(void* ptr); void* (*calloc_func)(size_t nmemb, size_t size); void* (*realloc_func)(void* ptr, size_t size); void* (*aligned_realloc_func)(void* ptr, size_t size, size_t alignment); } Il2CppMemoryCallbacks; typedef struct { const char* name; void(*connect)(const char* address); int(*wait_for_attach)(void); void(*close1)(void); void(*close2)(void); int(*send)(void* buf, int len); int(*recv)(void* buf, int len); } Il2CppDebuggerTransport; typedef uint16_t Il2CppChar; typedef char Il2CppNativeChar; typedef void (*il2cpp_register_object_callback)(Il2CppObject** arr, int size, void* userdata); typedef void (*il2cpp_WorldChangedCallback)(); typedef void (*Il2CppFrameWalkFunc) (const Il2CppStackFrameInfo* info, void* user_data); typedef void (*Il2CppProfileFunc) (Il2CppProfiler* prof); typedef void (*Il2CppProfileMethodFunc) (Il2CppProfiler* prof, const MethodInfo* method); typedef void (*Il2CppProfileAllocFunc) (Il2CppProfiler* prof, Il2CppObject* obj, Il2CppClass* klass); typedef void (*Il2CppProfileGCFunc) (Il2CppProfiler* prof, Il2CppGCEvent event, int generation); typedef void (*Il2CppProfileGCResizeFunc) (Il2CppProfiler* prof, int64_t new_size); typedef void (*Il2CppProfileFileIOFunc) (Il2CppProfiler* prof, Il2CppProfileFileIOKind kind, int count); typedef void (*Il2CppProfileThreadFunc) (Il2CppProfiler* prof, unsigned long tid); typedef const Il2CppNativeChar* (*Il2CppSetFindPlugInCallback)(const Il2CppNativeChar*); typedef void (*Il2CppLogCallback)(const char*); typedef size_t(*Il2CppBacktraceFunc) (Il2CppMethodPointer* buffer, size_t maxSize); typedef struct Il2CppManagedMemorySnapshot Il2CppManagedMemorySnapshot; typedef uintptr_t il2cpp_array_size_t; typedef void (*SynchronizationContextCallback)(intptr_t arg); typedef uint32_t Il2CppMethodSlot; static const uint32_t kInvalidIl2CppMethodSlot = 65535; static const int ipv6AddressSize = 16; typedef int32_t il2cpp_hresult_t; typedef struct Il2CppMetadataField { uint32_t offset; uint32_t typeIndex; const char* name; uint8_t isStatic; } Il2CppMetadataField; typedef enum Il2CppMetadataTypeFlags { kNone = 0, kValueType = 1 << 0, kArray = 1 << 1, kArrayRankMask = 0xFFFF0000 } Il2CppMetadataTypeFlags; typedef struct Il2CppMetadataType { Il2CppMetadataTypeFlags flags; Il2CppMetadataField* fields; uint32_t fieldCount; uint32_t staticsSize; uint8_t* statics; uint32_t baseOrElementTypeIndex; char* name; const char* assemblyName; uint64_t typeInfoAddress; uint32_t size; } Il2CppMetadataType; typedef struct Il2CppMetadataSnapshot { uint32_t typeCount; Il2CppMetadataType* types; } Il2CppMetadataSnapshot; typedef struct Il2CppManagedMemorySection { uint64_t sectionStartAddress; uint32_t sectionSize; uint8_t* sectionBytes; } Il2CppManagedMemorySection; typedef struct Il2CppManagedHeap { uint32_t sectionCount; Il2CppManagedMemorySection* sections; } Il2CppManagedHeap; typedef struct Il2CppStacks { uint32_t stackCount; Il2CppManagedMemorySection* stacks; } Il2CppStacks; typedef struct NativeObject { uint32_t gcHandleIndex; uint32_t size; uint32_t instanceId; uint32_t classId; uint32_t referencedNativeObjectIndicesCount; uint32_t* referencedNativeObjectIndices; } NativeObject; typedef struct Il2CppGCHandles { uint32_t trackedObjectCount; uint64_t* pointersToObjects; } Il2CppGCHandles; typedef struct Il2CppRuntimeInformation { uint32_t pointerSize; uint32_t objectHeaderSize; uint32_t arrayHeaderSize; uint32_t arrayBoundsOffsetInHeader; uint32_t arraySizeOffsetInHeader; uint32_t allocationGranularity; } Il2CppRuntimeInformation; typedef struct Il2CppManagedMemorySnapshot { Il2CppManagedHeap heap; Il2CppStacks stacks; Il2CppMetadataSnapshot metadata; Il2CppGCHandles gcHandles; Il2CppRuntimeInformation runtimeInformation; void* additionalUserInformation; } Il2CppManagedMemorySnapshot; typedef enum Il2CppTypeEnum { IL2CPP_TYPE_END = 0x00, IL2CPP_TYPE_VOID = 0x01, IL2CPP_TYPE_BOOLEAN = 0x02, IL2CPP_TYPE_CHAR = 0x03, IL2CPP_TYPE_I1 = 0x04, IL2CPP_TYPE_U1 = 0x05, IL2CPP_TYPE_I2 = 0x06, IL2CPP_TYPE_U2 = 0x07, IL2CPP_TYPE_I4 = 0x08, IL2CPP_TYPE_U4 = 0x09, IL2CPP_TYPE_I8 = 0x0a, IL2CPP_TYPE_U8 = 0x0b, IL2CPP_TYPE_R4 = 0x0c, IL2CPP_TYPE_R8 = 0x0d, IL2CPP_TYPE_STRING = 0x0e, IL2CPP_TYPE_PTR = 0x0f, IL2CPP_TYPE_BYREF = 0x10, IL2CPP_TYPE_VALUETYPE = 0x11, IL2CPP_TYPE_CLASS = 0x12, IL2CPP_TYPE_VAR = 0x13, IL2CPP_TYPE_ARRAY = 0x14, IL2CPP_TYPE_GENERICINST = 0x15, IL2CPP_TYPE_TYPEDBYREF = 0x16, IL2CPP_TYPE_I = 0x18, IL2CPP_TYPE_U = 0x19, IL2CPP_TYPE_FNPTR = 0x1b, IL2CPP_TYPE_OBJECT = 0x1c, IL2CPP_TYPE_SZARRAY = 0x1d, IL2CPP_TYPE_MVAR = 0x1e, IL2CPP_TYPE_CMOD_REQD = 0x1f, IL2CPP_TYPE_CMOD_OPT = 0x20, IL2CPP_TYPE_INTERNAL = 0x21, IL2CPP_TYPE_MODIFIER = 0x40, IL2CPP_TYPE_SENTINEL = 0x41, IL2CPP_TYPE_PINNED = 0x45, IL2CPP_TYPE_ENUM = 0x55 } Il2CppTypeEnum; typedef enum { IL2CPP_TOKEN_MODULE = 0x00000000, IL2CPP_TOKEN_TYPE_REF = 0x01000000, IL2CPP_TOKEN_TYPE_DEF = 0x02000000, IL2CPP_TOKEN_FIELD_DEF = 0x04000000, IL2CPP_TOKEN_METHOD_DEF = 0x06000000, IL2CPP_TOKEN_PARAM_DEF = 0x08000000, IL2CPP_TOKEN_INTERFACE_IMPL = 0x09000000, IL2CPP_TOKEN_MEMBER_REF = 0x0a000000, IL2CPP_TOKEN_CUSTOM_ATTRIBUTE = 0x0c000000, IL2CPP_TOKEN_PERMISSION = 0x0e000000, IL2CPP_TOKEN_SIGNATURE = 0x11000000, IL2CPP_TOKEN_EVENT = 0x14000000, IL2CPP_TOKEN_PROPERTY = 0x17000000, IL2CPP_TOKEN_MODULE_REF = 0x1a000000, IL2CPP_TOKEN_TYPE_SPEC = 0x1b000000, IL2CPP_TOKEN_ASSEMBLY = 0x20000000, IL2CPP_TOKEN_ASSEMBLY_REF = 0x23000000, IL2CPP_TOKEN_FILE = 0x26000000, IL2CPP_TOKEN_EXPORTED_TYPE = 0x27000000, IL2CPP_TOKEN_MANIFEST_RESOURCE = 0x28000000, IL2CPP_TOKEN_GENERIC_PARAM = 0x2a000000, IL2CPP_TOKEN_METHOD_SPEC = 0x2b000000, } Il2CppTokenType; typedef int32_t TypeIndex; typedef int32_t TypeDefinitionIndex; typedef int32_t FieldIndex; typedef int32_t DefaultValueIndex; typedef int32_t DefaultValueDataIndex; typedef int32_t CustomAttributeIndex; typedef int32_t ParameterIndex; typedef int32_t MethodIndex; typedef int32_t GenericMethodIndex; typedef int32_t PropertyIndex; typedef int32_t EventIndex; typedef int32_t GenericContainerIndex; typedef int32_t GenericParameterIndex; typedef int16_t GenericParameterConstraintIndex; typedef int32_t NestedTypeIndex; typedef int32_t InterfacesIndex; typedef int32_t VTableIndex; typedef int32_t InterfaceOffsetIndex; typedef int32_t RGCTXIndex; typedef int32_t StringIndex; typedef int32_t StringLiteralIndex; typedef int32_t GenericInstIndex; typedef int32_t ImageIndex; typedef int32_t AssemblyIndex; typedef int32_t InteropDataIndex; static const TypeIndex kTypeIndexInvalid = -1; static const TypeDefinitionIndex kTypeDefinitionIndexInvalid = -1; static const DefaultValueDataIndex kDefaultValueIndexNull = -1; static const CustomAttributeIndex kCustomAttributeIndexInvalid = -1; static const EventIndex kEventIndexInvalid = -1; static const FieldIndex kFieldIndexInvalid = -1; static const MethodIndex kMethodIndexInvalid = -1; static const PropertyIndex kPropertyIndexInvalid = -1; static const GenericContainerIndex kGenericContainerIndexInvalid = -1; static const GenericParameterIndex kGenericParameterIndexInvalid = -1; static const RGCTXIndex kRGCTXIndexInvalid = -1; static const StringLiteralIndex kStringLiteralIndexInvalid = -1; static const InteropDataIndex kInteropDataIndexInvalid = -1; typedef uint32_t EncodedMethodIndex; typedef enum Il2CppMetadataUsage { kIl2CppMetadataUsageInvalid, kIl2CppMetadataUsageTypeInfo, kIl2CppMetadataUsageIl2CppType, kIl2CppMetadataUsageMethodDef, kIl2CppMetadataUsageFieldInfo, kIl2CppMetadataUsageStringLiteral, kIl2CppMetadataUsageMethodRef, } Il2CppMetadataUsage; typedef struct Il2CppImage Il2CppImage; typedef struct Il2CppType Il2CppType; typedef struct Il2CppTypeDefinitionMetadata Il2CppTypeDefinitionMetadata; typedef union Il2CppRGCTXDefinitionData { int32_t rgctxDataDummy; MethodIndex methodIndex; TypeIndex typeIndex; } Il2CppRGCTXDefinitionData; typedef enum Il2CppRGCTXDataType { IL2CPP_RGCTX_DATA_INVALID, IL2CPP_RGCTX_DATA_TYPE, IL2CPP_RGCTX_DATA_CLASS, IL2CPP_RGCTX_DATA_METHOD, IL2CPP_RGCTX_DATA_ARRAY, } Il2CppRGCTXDataType; typedef struct Il2CppRGCTXDefinition { Il2CppRGCTXDataType type; Il2CppRGCTXDefinitionData data; } Il2CppRGCTXDefinition; typedef struct Il2CppInterfaceOffsetPair { TypeIndex interfaceTypeIndex; int32_t offset; } Il2CppInterfaceOffsetPair; typedef struct Il2CppTypeDefinition { StringIndex nameIndex; StringIndex namespaceIndex; TypeIndex byvalTypeIndex; TypeIndex byrefTypeIndex; TypeIndex declaringTypeIndex; TypeIndex parentIndex; TypeIndex elementTypeIndex; GenericContainerIndex genericContainerIndex; uint32_t flags; FieldIndex fieldStart; MethodIndex methodStart; EventIndex eventStart; PropertyIndex propertyStart; NestedTypeIndex nestedTypesStart; InterfacesIndex interfacesStart; VTableIndex vtableStart; InterfacesIndex interfaceOffsetsStart; uint16_t method_count; uint16_t property_count; uint16_t field_count; uint16_t event_count; uint16_t nested_type_count; uint16_t vtable_count; uint16_t interfaces_count; uint16_t interface_offsets_count; uint32_t bitfield; uint32_t token; } Il2CppTypeDefinition; typedef struct Il2CppFieldDefinition { StringIndex nameIndex; TypeIndex typeIndex; uint32_t token; } Il2CppFieldDefinition; typedef struct Il2CppFieldDefaultValue { FieldIndex fieldIndex; TypeIndex typeIndex; DefaultValueDataIndex dataIndex; } Il2CppFieldDefaultValue; typedef struct Il2CppFieldMarshaledSize { FieldIndex fieldIndex; TypeIndex typeIndex; int32_t size; } Il2CppFieldMarshaledSize; typedef struct Il2CppFieldRef { TypeIndex typeIndex; FieldIndex fieldIndex; } Il2CppFieldRef; typedef struct Il2CppParameterDefinition { StringIndex nameIndex; uint32_t token; TypeIndex typeIndex; } Il2CppParameterDefinition; typedef struct Il2CppParameterDefaultValue { ParameterIndex parameterIndex; TypeIndex typeIndex; DefaultValueDataIndex dataIndex; } Il2CppParameterDefaultValue; typedef struct Il2CppMethodDefinition { StringIndex nameIndex; TypeDefinitionIndex declaringType; TypeIndex returnType; ParameterIndex parameterStart; GenericContainerIndex genericContainerIndex; uint32_t token; uint16_t flags; uint16_t iflags; uint16_t slot; uint16_t parameterCount; } Il2CppMethodDefinition; typedef struct Il2CppEventDefinition { StringIndex nameIndex; TypeIndex typeIndex; MethodIndex add; MethodIndex remove; MethodIndex raise; uint32_t token; } Il2CppEventDefinition; typedef struct Il2CppPropertyDefinition { StringIndex nameIndex; MethodIndex get; MethodIndex set; uint32_t attrs; uint32_t token; } Il2CppPropertyDefinition; typedef struct Il2CppMethodSpec { MethodIndex methodDefinitionIndex; GenericInstIndex classIndexIndex; GenericInstIndex methodIndexIndex; } Il2CppMethodSpec; typedef struct Il2CppStringLiteral { uint32_t length; StringLiteralIndex dataIndex; } Il2CppStringLiteral; typedef struct { MethodIndex methodIndex; MethodIndex invokerIndex; MethodIndex adjustorThunkIndex; } Il2CppGenericMethodIndices; typedef struct Il2CppGenericMethodFunctionsDefinitions { GenericMethodIndex genericMethodIndex; Il2CppGenericMethodIndices indices; } Il2CppGenericMethodFunctionsDefinitions; static const int kPublicKeyByteLength = 8; typedef struct Il2CppAssemblyNameDefinition { StringIndex nameIndex; StringIndex cultureIndex; StringIndex publicKeyIndex; uint32_t hash_alg; int32_t hash_len; uint32_t flags; int32_t major; int32_t minor; int32_t build; int32_t revision; uint8_t public_key_token[8]; } Il2CppAssemblyNameDefinition; typedef struct Il2CppImageDefinition { StringIndex nameIndex; AssemblyIndex assemblyIndex; TypeDefinitionIndex typeStart; uint32_t typeCount; TypeDefinitionIndex exportedTypeStart; uint32_t exportedTypeCount; MethodIndex entryPointIndex; uint32_t token; CustomAttributeIndex customAttributeStart; uint32_t customAttributeCount; } Il2CppImageDefinition; typedef struct Il2CppAssemblyDefinition { ImageIndex imageIndex; uint32_t token; int32_t referencedAssemblyStart; int32_t referencedAssemblyCount; Il2CppAssemblyNameDefinition aname; } Il2CppAssemblyDefinition; typedef struct Il2CppMetadataUsageList { uint32_t start; uint32_t count; } Il2CppMetadataUsageList; typedef struct Il2CppMetadataUsagePair { uint32_t destinationIndex; uint32_t encodedSourceIndex; } Il2CppMetadataUsagePair; typedef struct Il2CppCustomAttributeTypeRange { uint32_t token; int32_t start; int32_t count; } Il2CppCustomAttributeTypeRange; typedef struct Il2CppRange { int32_t start; int32_t length; } Il2CppRange; typedef struct Il2CppWindowsRuntimeTypeNamePair { StringIndex nameIndex; TypeIndex typeIndex; } Il2CppWindowsRuntimeTypeNamePair; #pragma pack(push, p1,4) typedef struct Il2CppGlobalMetadataHeader { int32_t sanity; int32_t version; int32_t stringLiteralOffset; int32_t stringLiteralCount; int32_t stringLiteralDataOffset; int32_t stringLiteralDataCount; int32_t stringOffset; int32_t stringCount; int32_t eventsOffset; int32_t eventsCount; int32_t propertiesOffset; int32_t propertiesCount; int32_t methodsOffset; int32_t methodsCount; int32_t parameterDefaultValuesOffset; int32_t parameterDefaultValuesCount; int32_t fieldDefaultValuesOffset; int32_t fieldDefaultValuesCount; int32_t fieldAndParameterDefaultValueDataOffset; int32_t fieldAndParameterDefaultValueDataCount; int32_t fieldMarshaledSizesOffset; int32_t fieldMarshaledSizesCount; int32_t parametersOffset; int32_t parametersCount; int32_t fieldsOffset; int32_t fieldsCount; int32_t genericParametersOffset; int32_t genericParametersCount; int32_t genericParameterConstraintsOffset; int32_t genericParameterConstraintsCount; int32_t genericContainersOffset; int32_t genericContainersCount; int32_t nestedTypesOffset; int32_t nestedTypesCount; int32_t interfacesOffset; int32_t interfacesCount; int32_t vtableMethodsOffset; int32_t vtableMethodsCount; int32_t interfaceOffsetsOffset; int32_t interfaceOffsetsCount; int32_t typeDefinitionsOffset; int32_t typeDefinitionsCount; int32_t imagesOffset; int32_t imagesCount; int32_t assembliesOffset; int32_t assembliesCount; int32_t metadataUsageListsOffset; int32_t metadataUsageListsCount; int32_t metadataUsagePairsOffset; int32_t metadataUsagePairsCount; int32_t fieldRefsOffset; int32_t fieldRefsCount; int32_t referencedAssembliesOffset; int32_t referencedAssembliesCount; int32_t attributesInfoOffset; int32_t attributesInfoCount; int32_t attributeTypesOffset; int32_t attributeTypesCount; int32_t unresolvedVirtualCallParameterTypesOffset; int32_t unresolvedVirtualCallParameterTypesCount; int32_t unresolvedVirtualCallParameterRangesOffset; int32_t unresolvedVirtualCallParameterRangesCount; int32_t windowsRuntimeTypeNamesOffset; int32_t windowsRuntimeTypeNamesSize; int32_t exportedTypeDefinitionsOffset; int32_t exportedTypeDefinitionsCount; } Il2CppGlobalMetadataHeader; #pragma pack(pop, p1) typedef struct Il2CppClass Il2CppClass; typedef struct MethodInfo MethodInfo; typedef struct Il2CppType Il2CppType; typedef struct Il2CppArrayType { const Il2CppType* etype; uint8_t rank; uint8_t numsizes; uint8_t numlobounds; int* sizes; int* lobounds; } Il2CppArrayType; typedef struct Il2CppGenericInst { uint32_t type_argc; const Il2CppType** type_argv; } Il2CppGenericInst; typedef struct Il2CppGenericContext { const Il2CppGenericInst* class_inst; const Il2CppGenericInst* method_inst; } Il2CppGenericContext; typedef struct Il2CppGenericParameter { GenericContainerIndex ownerIndex; StringIndex nameIndex; GenericParameterConstraintIndex constraintsStart; int16_t constraintsCount; uint16_t num; uint16_t flags; } Il2CppGenericParameter; typedef struct Il2CppGenericContainer { int32_t ownerIndex; int32_t type_argc; int32_t is_method; GenericParameterIndex genericParameterStart; } Il2CppGenericContainer; typedef struct Il2CppGenericClass { TypeDefinitionIndex typeDefinitionIndex; Il2CppGenericContext context; Il2CppClass* cached_class; } Il2CppGenericClass; typedef struct Il2CppGenericMethod { const MethodInfo* methodDefinition; Il2CppGenericContext context; } Il2CppGenericMethod; typedef struct Il2CppType { union { void* dummy; TypeDefinitionIndex klassIndex; const Il2CppType* type; Il2CppArrayType* array; GenericParameterIndex genericParameterIndex; Il2CppGenericClass* generic_class; } data; unsigned int attrs : 16; Il2CppTypeEnum type : 8; unsigned int num_mods : 6; unsigned int byref : 1; unsigned int pinned : 1; } Il2CppType; typedef enum Il2CppCallConvention { IL2CPP_CALL_DEFAULT, IL2CPP_CALL_C, IL2CPP_CALL_STDCALL, IL2CPP_CALL_THISCALL, IL2CPP_CALL_FASTCALL, IL2CPP_CALL_VARARG } Il2CppCallConvention; typedef enum Il2CppCharSet { CHARSET_ANSI, CHARSET_UNICODE, CHARSET_NOT_SPECIFIED } Il2CppCharSet; typedef struct Il2CppHString__ { int unused; } Il2CppHString__; typedef Il2CppHString__* Il2CppHString; typedef struct Il2CppHStringHeader { union { void* Reserved1; char Reserved2[24]; } Reserved; } Il2CppHStringHeader; typedef struct Il2CppGuid { uint32_t data1; uint16_t data2; uint16_t data3; uint8_t data4[8]; } Il2CppGuid; typedef struct Il2CppSafeArrayBound { uint32_t element_count; int32_t lower_bound; } Il2CppSafeArrayBound; typedef struct Il2CppSafeArray { uint16_t dimension_count; uint16_t features; uint32_t element_size; uint32_t lock_count; void* data; Il2CppSafeArrayBound bounds[1]; } Il2CppSafeArray; typedef struct Il2CppWin32Decimal { uint16_t reserved; union { struct { uint8_t scale; uint8_t sign; } s; uint16_t signscale; } u; uint32_t hi32; union { struct { uint32_t lo32; uint32_t mid32; } s2; uint64_t lo64; } u2; } Il2CppWin32Decimal; typedef int16_t IL2CPP_VARIANT_BOOL; typedef enum Il2CppVarType { IL2CPP_VT_EMPTY = 0, IL2CPP_VT_NULL = 1, IL2CPP_VT_I2 = 2, IL2CPP_VT_I4 = 3, IL2CPP_VT_R4 = 4, IL2CPP_VT_R8 = 5, IL2CPP_VT_CY = 6, IL2CPP_VT_DATE = 7, IL2CPP_VT_BSTR = 8, IL2CPP_VT_DISPATCH = 9, IL2CPP_VT_ERROR = 10, IL2CPP_VT_BOOL = 11, IL2CPP_VT_VARIANT = 12, IL2CPP_VT_UNKNOWN = 13, IL2CPP_VT_DECIMAL = 14, IL2CPP_VT_I1 = 16, IL2CPP_VT_UI1 = 17, IL2CPP_VT_UI2 = 18, IL2CPP_VT_UI4 = 19, IL2CPP_VT_I8 = 20, IL2CPP_VT_UI8 = 21, IL2CPP_VT_INT = 22, IL2CPP_VT_UINT = 23, IL2CPP_VT_VOID = 24, IL2CPP_VT_HRESULT = 25, IL2CPP_VT_PTR = 26, IL2CPP_VT_SAFEARRAY = 27, IL2CPP_VT_CARRAY = 28, IL2CPP_VT_USERDEFINED = 29, IL2CPP_VT_LPSTR = 30, IL2CPP_VT_LPWSTR = 31, IL2CPP_VT_RECORD = 36, IL2CPP_VT_INT_PTR = 37, IL2CPP_VT_UINT_PTR = 38, IL2CPP_VT_FILETIME = 64, IL2CPP_VT_BLOB = 65, IL2CPP_VT_STREAM = 66, IL2CPP_VT_STORAGE = 67, IL2CPP_VT_STREAMED_OBJECT = 68, IL2CPP_VT_STORED_OBJECT = 69, IL2CPP_VT_BLOB_OBJECT = 70, IL2CPP_VT_CF = 71, IL2CPP_VT_CLSID = 72, IL2CPP_VT_VERSIONED_STREAM = 73, IL2CPP_VT_BSTR_BLOB = 0xfff, IL2CPP_VT_VECTOR = 0x1000, IL2CPP_VT_ARRAY = 0x2000, IL2CPP_VT_BYREF = 0x4000, IL2CPP_VT_RESERVED = 0x8000, IL2CPP_VT_ILLEGAL = 0xffff, IL2CPP_VT_ILLEGALMASKED = 0xfff, IL2CPP_VT_TYPEMASK = 0xfff, } Il2CppVarType; typedef struct Il2CppVariant Il2CppVariant; typedef struct Il2CppIUnknown Il2CppIUnknown; typedef struct Il2CppVariant { union { struct __tagVARIANT { uint16_t type; uint16_t reserved1; uint16_t reserved2; uint16_t reserved3; union { int64_t llVal; int32_t lVal; uint8_t bVal; int16_t iVal; float fltVal; double dblVal; IL2CPP_VARIANT_BOOL boolVal; int32_t scode; int64_t cyVal; double date; Il2CppChar* bstrVal; Il2CppIUnknown* punkVal; void* pdispVal; Il2CppSafeArray* parray; uint8_t* pbVal; int16_t* piVal; int32_t* plVal; int64_t* pllVal; float* pfltVal; double* pdblVal; IL2CPP_VARIANT_BOOL* pboolVal; int32_t* pscode; int64_t* pcyVal; double* pdate; Il2CppChar* pbstrVal; Il2CppIUnknown** ppunkVal; void** ppdispVal; Il2CppSafeArray** pparray; struct Il2CppVariant* pvarVal; void* byref; char cVal; uint16_t uiVal; uint32_t ulVal; uint64_t ullVal; int intVal; unsigned int uintVal; Il2CppWin32Decimal* pdecVal; char* pcVal; uint16_t* puiVal; uint32_t* pulVal; uint64_t* pullVal; int* pintVal; unsigned int* puintVal; struct __tagBRECORD { void* pvRecord; void* pRecInfo; } n4; } n3; } n2; Il2CppWin32Decimal decVal; } n1; } Il2CppVariant; typedef struct Il2CppFileTime { uint32_t low; uint32_t high; } Il2CppFileTime; typedef struct Il2CppStatStg { Il2CppChar* name; uint32_t type; uint64_t size; Il2CppFileTime mtime; Il2CppFileTime ctime; Il2CppFileTime atime; uint32_t mode; uint32_t locks; Il2CppGuid clsid; uint32_t state; uint32_t reserved; } Il2CppStatStg; typedef enum Il2CppWindowsRuntimeTypeKind { kTypeKindPrimitive = 0, kTypeKindMetadata, kTypeKindCustom } Il2CppWindowsRuntimeTypeKind; typedef struct Il2CppWindowsRuntimeTypeName { Il2CppHString typeName; enum Il2CppWindowsRuntimeTypeKind typeKind; } Il2CppWindowsRuntimeTypeName; typedef void (*PInvokeMarshalToNativeFunc)(void* managedStructure, void* marshaledStructure); typedef void (*PInvokeMarshalFromNativeFunc)(void* marshaledStructure, void* managedStructure); typedef void (*PInvokeMarshalCleanupFunc)(void* marshaledStructure); typedef struct Il2CppIUnknown* (*CreateCCWFunc)(Il2CppObject* obj); typedef struct Il2CppInteropData { Il2CppMethodPointer delegatePInvokeWrapperFunction; PInvokeMarshalToNativeFunc pinvokeMarshalToNativeFunction; PInvokeMarshalFromNativeFunc pinvokeMarshalFromNativeFunction; PInvokeMarshalCleanupFunc pinvokeMarshalCleanupFunction; CreateCCWFunc createCCWFunction; const Il2CppGuid* guid; const Il2CppType* type; } Il2CppInteropData; typedef struct Il2CppClass Il2CppClass; typedef struct Il2CppGuid Il2CppGuid; typedef struct Il2CppImage Il2CppImage; typedef struct Il2CppAppDomain Il2CppAppDomain; typedef struct Il2CppAppDomainSetup Il2CppAppDomainSetup; typedef struct Il2CppDelegate Il2CppDelegate; typedef struct Il2CppAppContext Il2CppAppContext; typedef struct Il2CppNameToTypeDefinitionIndexHashTable Il2CppNameToTypeDefinitionIndexHashTable; typedef struct Il2CppCodeGenModule Il2CppCodeGenModule; typedef struct VirtualInvokeData { Il2CppMethodPointer methodPtr; const MethodInfo* method; } VirtualInvokeData; typedef enum Il2CppTypeNameFormat { IL2CPP_TYPE_NAME_FORMAT_IL, IL2CPP_TYPE_NAME_FORMAT_REFLECTION, IL2CPP_TYPE_NAME_FORMAT_FULL_NAME, IL2CPP_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED } Il2CppTypeNameFormat; typedef struct Il2CppDefaults { Il2CppImage* corlib; Il2CppClass* object_class; Il2CppClass* byte_class; Il2CppClass* void_class; Il2CppClass* boolean_class; Il2CppClass* sbyte_class; Il2CppClass* int16_class; Il2CppClass* uint16_class; Il2CppClass* int32_class; Il2CppClass* uint32_class; Il2CppClass* int_class; Il2CppClass* uint_class; Il2CppClass* int64_class; Il2CppClass* uint64_class; Il2CppClass* single_class; Il2CppClass* double_class; Il2CppClass* char_class; Il2CppClass* string_class; Il2CppClass* enum_class; Il2CppClass* array_class; Il2CppClass* delegate_class; Il2CppClass* multicastdelegate_class; Il2CppClass* asyncresult_class; Il2CppClass* manualresetevent_class; Il2CppClass* typehandle_class; Il2CppClass* fieldhandle_class; Il2CppClass* methodhandle_class; Il2CppClass* systemtype_class; Il2CppClass* monotype_class; Il2CppClass* exception_class; Il2CppClass* threadabortexception_class; Il2CppClass* thread_class; Il2CppClass* internal_thread_class; Il2CppClass* appdomain_class; Il2CppClass* appdomain_setup_class; Il2CppClass* field_info_class; Il2CppClass* method_info_class; Il2CppClass* property_info_class; Il2CppClass* event_info_class; Il2CppClass* mono_event_info_class; Il2CppClass* stringbuilder_class; Il2CppClass* stack_frame_class; Il2CppClass* stack_trace_class; Il2CppClass* marshal_class; Il2CppClass* typed_reference_class; Il2CppClass* marshalbyrefobject_class; Il2CppClass* generic_ilist_class; Il2CppClass* generic_icollection_class; Il2CppClass* generic_ienumerable_class; Il2CppClass* generic_ireadonlylist_class; Il2CppClass* generic_ireadonlycollection_class; Il2CppClass* runtimetype_class; Il2CppClass* generic_nullable_class; Il2CppClass* il2cpp_com_object_class; Il2CppClass* attribute_class; Il2CppClass* customattribute_data_class; Il2CppClass* version; Il2CppClass* culture_info; Il2CppClass* async_call_class; Il2CppClass* assembly_class; Il2CppClass* mono_assembly_class; Il2CppClass* assembly_name_class; Il2CppClass* mono_field_class; Il2CppClass* mono_method_class; Il2CppClass* mono_method_info_class; Il2CppClass* mono_property_info_class; Il2CppClass* parameter_info_class; Il2CppClass* mono_parameter_info_class; Il2CppClass* module_class; Il2CppClass* pointer_class; Il2CppClass* system_exception_class; Il2CppClass* argument_exception_class; Il2CppClass* wait_handle_class; Il2CppClass* safe_handle_class; Il2CppClass* sort_key_class; Il2CppClass* dbnull_class; Il2CppClass* error_wrapper_class; Il2CppClass* missing_class; Il2CppClass* value_type_class; Il2CppClass* threadpool_wait_callback_class; MethodInfo* threadpool_perform_wait_callback_method; Il2CppClass* mono_method_message_class; Il2CppClass* ireference_class; Il2CppClass* ireferencearray_class; Il2CppClass* ikey_value_pair_class; Il2CppClass* key_value_pair_class; Il2CppClass* windows_foundation_uri_class; Il2CppClass* windows_foundation_iuri_runtime_class_class; Il2CppClass* system_uri_class; Il2CppClass* system_guid_class; Il2CppClass* sbyte_shared_enum; Il2CppClass* int16_shared_enum; Il2CppClass* int32_shared_enum; Il2CppClass* int64_shared_enum; Il2CppClass* byte_shared_enum; Il2CppClass* uint16_shared_enum; Il2CppClass* uint32_shared_enum; Il2CppClass* uint64_shared_enum; } Il2CppDefaults; extern Il2CppDefaults il2cpp_defaults; typedef struct Il2CppClass Il2CppClass; typedef struct MethodInfo MethodInfo; typedef struct FieldInfo FieldInfo; typedef struct Il2CppObject Il2CppObject; typedef struct MemberInfo MemberInfo; typedef struct CustomAttributesCache { int count; Il2CppObject** attributes; } CustomAttributesCache; typedef void (*CustomAttributesCacheGenerator)(CustomAttributesCache*); typedef struct FieldInfo { const char* name; const Il2CppType* type; Il2CppClass* parent; int32_t offset; uint32_t token; } FieldInfo; typedef struct PropertyInfo { Il2CppClass* parent; const char* name; const MethodInfo* get; const MethodInfo* set; uint32_t attrs; uint32_t token; } PropertyInfo; typedef struct EventInfo { const char* name; const Il2CppType* eventType; Il2CppClass* parent; const MethodInfo* add; const MethodInfo* remove; const MethodInfo* raise; uint32_t token; } EventInfo; typedef struct ParameterInfo { const char* name; int32_t position; uint32_t token; const Il2CppType* parameter_type; } ParameterInfo; typedef void* (*InvokerMethod)(Il2CppMethodPointer, const MethodInfo*, void*, void**); typedef enum MethodVariableKind { kMethodVariableKind_This, kMethodVariableKind_Parameter, kMethodVariableKind_LocalVariable } MethodVariableKind; typedef enum SequencePointKind { kSequencePointKind_Normal, kSequencePointKind_StepOut } SequencePointKind; typedef struct Il2CppMethodExecutionContextInfo { TypeIndex typeIndex; int32_t nameIndex; int32_t scopeIndex; } Il2CppMethodExecutionContextInfo; typedef struct Il2CppMethodExecutionContextInfoIndex { int32_t startIndex; int32_t count; } Il2CppMethodExecutionContextInfoIndex; typedef struct Il2CppMethodScope { int32_t startOffset; int32_t endOffset; } Il2CppMethodScope; typedef struct Il2CppMethodHeaderInfo { int32_t code_size; int32_t startScope; int32_t numScopes; } Il2CppMethodHeaderInfo; typedef struct Il2CppSequencePointSourceFile { const char* file; uint8_t hash[16]; } Il2CppSequencePointSourceFile; typedef struct Il2CppTypeSourceFilePair { TypeDefinitionIndex klassIndex; int32_t sourceFileIndex; } Il2CppTypeSourceFilePair; typedef struct Il2CppSequencePoint { MethodIndex methodDefinitionIndex; int32_t sourceFileIndex; int32_t lineStart, lineEnd; int32_t columnStart, columnEnd; int32_t ilOffset; SequencePointKind kind; int32_t isActive; int32_t id; } Il2CppSequencePoint; typedef struct Il2CppCatchPoint { MethodIndex methodDefinitionIndex; TypeIndex catchTypeIndex; int32_t ilOffset; int32_t tryId; int32_t parentTryId; } Il2CppCatchPoint; typedef struct Il2CppDebuggerMetadataRegistration { Il2CppMethodExecutionContextInfo* methodExecutionContextInfos; Il2CppMethodExecutionContextInfoIndex* methodExecutionContextInfoIndexes; Il2CppMethodScope* methodScopes; Il2CppMethodHeaderInfo* methodHeaderInfos; Il2CppSequencePointSourceFile* sequencePointSourceFiles; int32_t numSequencePoints; Il2CppSequencePoint* sequencePoints; int32_t numCatchPoints; Il2CppCatchPoint* catchPoints; int32_t numTypeSourceFileEntries; Il2CppTypeSourceFilePair* typeSourceFiles; const char** methodExecutionContextInfoStrings; } Il2CppDebuggerMetadataRegistration; typedef union Il2CppRGCTXData { void* rgctxDataDummy; const MethodInfo* method; const Il2CppType* type; Il2CppClass* klass; } Il2CppRGCTXData; typedef struct MethodInfo { Il2CppMethodPointer methodPointer; InvokerMethod invoker_method; const char* name; Il2CppClass* klass; const Il2CppType* return_type; const ParameterInfo* parameters; union { const Il2CppRGCTXData* rgctx_data; const Il2CppMethodDefinition* methodDefinition; }; union { const Il2CppGenericMethod* genericMethod; const Il2CppGenericContainer* genericContainer; }; uint32_t token; uint16_t flags; uint16_t iflags; uint16_t slot; uint8_t parameters_count; uint8_t is_generic : 1; uint8_t is_inflated : 1; uint8_t wrapper_type : 1; uint8_t is_marshaled_from_native : 1; } MethodInfo; typedef struct Il2CppRuntimeInterfaceOffsetPair { Il2CppClass* interfaceType; int32_t offset; } Il2CppRuntimeInterfaceOffsetPair; typedef struct Il2CppClass { const Il2CppImage* image; void* gc_desc; const char* name; const char* namespaze; Il2CppType byval_arg; Il2CppType this_arg; Il2CppClass* element_class; Il2CppClass* castClass; Il2CppClass* declaringType; Il2CppClass* parent; Il2CppGenericClass* generic_class; const Il2CppTypeDefinition* typeDefinition; const Il2CppInteropData* interopData; Il2CppClass* klass; FieldInfo* fields; const EventInfo* events; const PropertyInfo* properties; const MethodInfo** methods; Il2CppClass** nestedTypes; Il2CppClass** implementedInterfaces; Il2CppRuntimeInterfaceOffsetPair* interfaceOffsets; void* static_fields; const Il2CppRGCTXData* rgctx_data; struct Il2CppClass** typeHierarchy; void* unity_user_data; uint32_t initializationExceptionGCHandle; uint32_t cctor_started; uint32_t cctor_finished; uint32_t cctor_thread__padding; uint32_t cctor_thread; uint32_t cctor_thread__hi; GenericContainerIndex genericContainerIndex; uint32_t instance_size; uint32_t actualSize; uint32_t element_size; int32_t native_size; uint32_t static_fields_size; uint32_t thread_static_fields_size; int32_t thread_static_fields_offset; uint32_t flags; uint32_t token; uint16_t method_count; uint16_t property_count; uint16_t field_count; uint16_t event_count; uint16_t nested_type_count; uint16_t vtable_count; uint16_t interfaces_count; uint16_t interface_offsets_count; uint8_t typeHierarchyDepth; uint8_t genericRecursionDepth; uint8_t rank; uint8_t minimumAlignment; uint8_t naturalAligment; uint8_t packingSize; uint8_t initialized_and_no_error : 1; uint8_t valuetype : 1; uint8_t initialized : 1; uint8_t enumtype : 1; uint8_t is_generic : 1; uint8_t has_references : 1; uint8_t init_pending : 1; uint8_t size_inited : 1; uint8_t has_finalize : 1; uint8_t has_cctor : 1; uint8_t is_blittable : 1; uint8_t is_import_or_windows_runtime : 1; uint8_t is_vtable_initialized : 1; uint8_t has_initialization_error : 1; VirtualInvokeData vtable[32]; } Il2CppClass; typedef struct Il2CppTypeDefinitionSizes { uint32_t instance_size; int32_t native_size; uint32_t static_fields_size; uint32_t thread_static_fields_size; } Il2CppTypeDefinitionSizes; typedef struct Il2CppDomain { Il2CppAppDomain* domain; Il2CppAppDomainSetup* setup; Il2CppAppContext* default_context; const char* friendly_name; uint32_t domain_id; volatile int threadpool_jobs; void* agent_info; } Il2CppDomain; typedef struct Il2CppAssemblyName { const char* name; const char* culture; const uint8_t* public_key; uint32_t hash_alg; int32_t hash_len; uint32_t flags; int32_t major; int32_t minor; int32_t build; int32_t revision; uint8_t public_key_token[8]; } Il2CppAssemblyName; typedef struct Il2CppImage { const char* name; const char* nameNoExt; Il2CppAssembly* assembly; TypeDefinitionIndex typeStart; uint32_t typeCount; TypeDefinitionIndex exportedTypeStart; uint32_t exportedTypeCount; CustomAttributeIndex customAttributeStart; uint32_t customAttributeCount; MethodIndex entryPointIndex; Il2CppNameToTypeDefinitionIndexHashTable* nameToClassHashTable; const Il2CppCodeGenModule* codeGenModule; uint32_t token; uint8_t dynamic; } Il2CppImage; typedef struct Il2CppAssembly { Il2CppImage* image; uint32_t token; int32_t referencedAssemblyStart; int32_t referencedAssemblyCount; Il2CppAssemblyName aname; } Il2CppAssembly; typedef struct Il2CppCodeGenOptions { uint8_t enablePrimitiveValueTypeGenericSharing; int maximumRuntimeGenericDepth; } Il2CppCodeGenOptions; typedef struct Il2CppTokenIndexPair { uint32_t token; int32_t index; } Il2CppTokenIndexPair; typedef struct Il2CppTokenRangePair { uint32_t token; Il2CppRange range; } Il2CppTokenRangePair; typedef struct Il2CppTokenIndexMethodTuple { uint32_t token; int32_t index; void** method; uint32_t genericMethodIndex; } Il2CppTokenIndexMethodTuple; typedef struct Il2CppTokenAdjustorThunkPair { uint32_t token; Il2CppMethodPointer adjustorThunk; } Il2CppTokenAdjustorThunkPair; typedef struct Il2CppWindowsRuntimeFactoryTableEntry { const Il2CppType* type; Il2CppMethodPointer createFactoryFunction; } Il2CppWindowsRuntimeFactoryTableEntry; typedef struct Il2CppCodeGenModule { const char* moduleName; const uint32_t methodPointerCount; const Il2CppMethodPointer* methodPointers; const uint32_t adjustorThunkCount; const Il2CppTokenAdjustorThunkPair* adjustorThunks; const int32_t* invokerIndices; const uint32_t reversePInvokeWrapperCount; const Il2CppTokenIndexMethodTuple* reversePInvokeWrapperIndices; const uint32_t rgctxRangesCount; const Il2CppTokenRangePair* rgctxRanges; const uint32_t rgctxsCount; const Il2CppRGCTXDefinition* rgctxs; const Il2CppDebuggerMetadataRegistration* debuggerMetadata; } Il2CppCodeGenModule; typedef struct Il2CppCodeRegistration { uint32_t reversePInvokeWrapperCount; const Il2CppMethodPointer* reversePInvokeWrappers; uint32_t genericMethodPointersCount; const Il2CppMethodPointer* genericMethodPointers; const Il2CppMethodPointer* genericAdjustorThunks; uint32_t invokerPointersCount; const InvokerMethod* invokerPointers; CustomAttributeIndex customAttributeCount; const CustomAttributesCacheGenerator* customAttributeGenerators; uint32_t unresolvedVirtualCallCount; const Il2CppMethodPointer* unresolvedVirtualCallPointers; uint32_t interopDataCount; Il2CppInteropData* interopData; uint32_t windowsRuntimeFactoryCount; Il2CppWindowsRuntimeFactoryTableEntry* windowsRuntimeFactoryTable; uint32_t codeGenModulesCount; const Il2CppCodeGenModule** codeGenModules; } Il2CppCodeRegistration; typedef struct Il2CppMetadataRegistration { int32_t genericClassesCount; Il2CppGenericClass* const* genericClasses; int32_t genericInstsCount; const Il2CppGenericInst* const* genericInsts; int32_t genericMethodTableCount; const Il2CppGenericMethodFunctionsDefinitions* genericMethodTable; int32_t typesCount; const Il2CppType* const* types; int32_t methodSpecsCount; const Il2CppMethodSpec* methodSpecs; FieldIndex fieldOffsetsCount; const int32_t** fieldOffsets; TypeDefinitionIndex typeDefinitionsSizesCount; const Il2CppTypeDefinitionSizes** typeDefinitionsSizes; const size_t metadataUsagesCount; void** const* metadataUsages; } Il2CppMetadataRegistration; typedef struct Il2CppPerfCounters { uint32_t jit_methods; uint32_t jit_bytes; uint32_t jit_time; uint32_t jit_failures; uint32_t exceptions_thrown; uint32_t exceptions_filters; uint32_t exceptions_finallys; uint32_t exceptions_depth; uint32_t aspnet_requests_queued; uint32_t aspnet_requests; uint32_t gc_collections0; uint32_t gc_collections1; uint32_t gc_collections2; uint32_t gc_promotions0; uint32_t gc_promotions1; uint32_t gc_promotion_finalizers; uint32_t gc_gen0size; uint32_t gc_gen1size; uint32_t gc_gen2size; uint32_t gc_lossize; uint32_t gc_fin_survivors; uint32_t gc_num_handles; uint32_t gc_allocated; uint32_t gc_induced; uint32_t gc_time; uint32_t gc_total_bytes; uint32_t gc_committed_bytes; uint32_t gc_reserved_bytes; uint32_t gc_num_pinned; uint32_t gc_sync_blocks; uint32_t remoting_calls; uint32_t remoting_channels; uint32_t remoting_proxies; uint32_t remoting_classes; uint32_t remoting_objects; uint32_t remoting_contexts; uint32_t loader_classes; uint32_t loader_total_classes; uint32_t loader_appdomains; uint32_t loader_total_appdomains; uint32_t loader_assemblies; uint32_t loader_total_assemblies; uint32_t loader_failures; uint32_t loader_bytes; uint32_t loader_appdomains_uloaded; uint32_t thread_contentions; uint32_t thread_queue_len; uint32_t thread_queue_max; uint32_t thread_num_logical; uint32_t thread_num_physical; uint32_t thread_cur_recognized; uint32_t thread_num_recognized; uint32_t interop_num_ccw; uint32_t interop_num_stubs; uint32_t interop_num_marshals; uint32_t security_num_checks; uint32_t security_num_link_checks; uint32_t security_time; uint32_t security_depth; uint32_t unused; uint64_t threadpool_workitems; uint64_t threadpool_ioworkitems; unsigned int threadpool_threads; unsigned int threadpool_iothreads; } Il2CppPerfCounters; typedef struct Il2CppClass Il2CppClass; typedef struct MethodInfo MethodInfo; typedef struct PropertyInfo PropertyInfo; typedef struct FieldInfo FieldInfo; typedef struct EventInfo EventInfo; typedef struct Il2CppType Il2CppType; typedef struct Il2CppAssembly Il2CppAssembly; typedef struct Il2CppException Il2CppException; typedef struct Il2CppImage Il2CppImage; typedef struct Il2CppDomain Il2CppDomain; typedef struct Il2CppString Il2CppString; typedef struct Il2CppReflectionMethod Il2CppReflectionMethod; typedef struct Il2CppAsyncCall Il2CppAsyncCall; typedef struct Il2CppIUnknown Il2CppIUnknown; typedef struct Il2CppWaitHandle Il2CppWaitHandle; typedef struct MonitorData MonitorData; typedef struct Il2CppReflectionAssembly Il2CppReflectionAssembly; typedef Il2CppClass Il2CppVTable; typedef struct Il2CppObject { union { Il2CppClass* klass; Il2CppVTable* vtable; }; MonitorData* monitor; } Il2CppObject; typedef int32_t il2cpp_array_lower_bound_t; typedef struct Il2CppArrayBounds { il2cpp_array_size_t length; il2cpp_array_lower_bound_t lower_bound; } Il2CppArrayBounds; typedef struct Il2CppArray { Il2CppObject obj; Il2CppArrayBounds* bounds; il2cpp_array_size_t max_length; } Il2CppArray; typedef struct Il2CppArraySize { Il2CppObject obj; Il2CppArrayBounds* bounds; il2cpp_array_size_t max_length; //__attribute__((aligned(8))) void* vector; } Il2CppArraySize; typedef struct Il2CppString { Il2CppObject object; int32_t length; Il2CppChar chars[32]; } Il2CppString; typedef struct Il2CppReflectionType { Il2CppObject object; const Il2CppType* type; } Il2CppReflectionType; typedef struct Il2CppReflectionRuntimeType { Il2CppReflectionType type; Il2CppObject* type_info; Il2CppObject* genericCache; Il2CppObject* serializationCtor; } Il2CppReflectionRuntimeType; typedef struct Il2CppReflectionMonoType { Il2CppReflectionRuntimeType type; } Il2CppReflectionMonoType; typedef struct Il2CppReflectionEvent { Il2CppObject object; Il2CppObject* cached_add_event; } Il2CppReflectionEvent; typedef struct Il2CppReflectionMonoEvent { Il2CppReflectionEvent event; Il2CppReflectionType* reflectedType; const EventInfo* eventInfo; } Il2CppReflectionMonoEvent; typedef struct Il2CppReflectionMonoEventInfo { Il2CppReflectionType* declaringType; Il2CppReflectionType* reflectedType; Il2CppString* name; Il2CppReflectionMethod* addMethod; Il2CppReflectionMethod* removeMethod; Il2CppReflectionMethod* raiseMethod; uint32_t eventAttributes; Il2CppArray* otherMethods; } Il2CppReflectionMonoEventInfo; typedef struct Il2CppReflectionField { Il2CppObject object; Il2CppClass* klass; FieldInfo* field; Il2CppString* name; Il2CppReflectionType* type; uint32_t attrs; } Il2CppReflectionField; typedef struct Il2CppReflectionProperty { Il2CppObject object; Il2CppClass* klass; const PropertyInfo* property; } Il2CppReflectionProperty; typedef struct Il2CppReflectionMethod { Il2CppObject object; const MethodInfo* method; Il2CppString* name; Il2CppReflectionType* reftype; } Il2CppReflectionMethod; typedef struct Il2CppReflectionGenericMethod { Il2CppReflectionMethod base; } Il2CppReflectionGenericMethod; typedef struct Il2CppMethodInfo { Il2CppReflectionType* parent; Il2CppReflectionType* ret; uint32_t attrs; uint32_t implattrs; uint32_t callconv; } Il2CppMethodInfo; typedef struct Il2CppPropertyInfo { Il2CppReflectionType* parent; Il2CppReflectionType* declaringType; Il2CppString* name; Il2CppReflectionMethod* get; Il2CppReflectionMethod* set; uint32_t attrs; } Il2CppPropertyInfo; typedef struct Il2CppReflectionParameter { Il2CppObject object; Il2CppReflectionType* ClassImpl; Il2CppObject* DefaultValueImpl; Il2CppObject* MemberImpl; Il2CppString* NameImpl; int32_t PositionImpl; uint32_t AttrsImpl; Il2CppObject* MarshalAsImpl; } Il2CppReflectionParameter; typedef struct Il2CppReflectionModule { Il2CppObject obj; const Il2CppImage* image; Il2CppReflectionAssembly* assembly; Il2CppString* fqname; Il2CppString* name; Il2CppString* scopename; uint8_t is_resource; uint32_t token; } Il2CppReflectionModule; typedef struct Il2CppReflectionAssemblyName { Il2CppObject obj; Il2CppString* name; Il2CppString* codebase; int32_t major, minor, build, revision; Il2CppObject* cultureInfo; uint32_t flags; uint32_t hashalg; Il2CppObject* keypair; Il2CppArray* publicKey; Il2CppArray* keyToken; uint32_t versioncompat; Il2CppObject* version; uint32_t processor_architecture; uint32_t contentType; } Il2CppReflectionAssemblyName; typedef struct Il2CppReflectionAssembly { Il2CppObject object; const Il2CppAssembly* assembly; Il2CppObject* resolve_event_holder; Il2CppObject* evidence; Il2CppObject* minimum; Il2CppObject* optional; Il2CppObject* refuse; Il2CppObject* granted; Il2CppObject* denied; uint8_t from_byte_array; Il2CppString* name; } Il2CppReflectionAssembly; typedef struct Il2CppReflectionMarshal { Il2CppObject object; int32_t count; int32_t type; int32_t eltype; Il2CppString* guid; Il2CppString* mcookie; Il2CppString* marshaltype; Il2CppObject* marshaltyperef; int32_t param_num; uint8_t has_size; } Il2CppReflectionMarshal; typedef struct Il2CppReflectionPointer { Il2CppObject object; void* data; Il2CppReflectionType* type; } Il2CppReflectionPointer; typedef struct Il2CppInternalThread { Il2CppObject obj; int lock_thread_id; void* handle; void* native_handle; Il2CppArray* cached_culture_info; Il2CppChar* name; int name_len; uint32_t state; Il2CppObject* abort_exc; int abort_state_handle; uint64_t tid; intptr_t debugger_thread; void** static_data; void* runtime_thread_info; Il2CppObject* current_appcontext; Il2CppObject* root_domain_thread; Il2CppArray* _serialized_principal; int _serialized_principal_version; void* appdomain_refs; int32_t interruption_requested; void* synch_cs; uint8_t threadpool_thread; uint8_t thread_interrupt_requested; int stack_size; uint8_t apartment_state; int critical_region_level; int managed_id; uint32_t small_id; void* manage_callback; void* interrupt_on_stop; intptr_t flags; void* thread_pinning_ref; void* abort_protected_block_count; int32_t priority; void* owned_mutexes; void* suspended; int32_t self_suspended; size_t thread_state; size_t unused2; void* last; } Il2CppInternalThread; typedef struct Il2CppIOSelectorJob { Il2CppObject object; int32_t operation; Il2CppObject* callback; Il2CppObject* state; } Il2CppIOSelectorJob; typedef enum { Il2Cpp_CallType_Sync = 0, Il2Cpp_CallType_BeginInvoke = 1, Il2Cpp_CallType_EndInvoke = 2, Il2Cpp_CallType_OneWay = 3 } Il2CppCallType; typedef struct Il2CppMethodMessage { Il2CppObject obj; Il2CppReflectionMethod* method; Il2CppArray* args; Il2CppArray* names; Il2CppArray* arg_types; Il2CppObject* ctx; Il2CppObject* rval; Il2CppObject* exc; Il2CppAsyncResult* async_result; uint32_t call_type; } Il2CppMethodMessage; typedef struct Il2CppAppDomainSetup { Il2CppObject object; Il2CppString* application_base; Il2CppString* application_name; Il2CppString* cache_path; Il2CppString* configuration_file; Il2CppString* dynamic_base; Il2CppString* license_file; Il2CppString* private_bin_path; Il2CppString* private_bin_path_probe; Il2CppString* shadow_copy_directories; Il2CppString* shadow_copy_files; uint8_t publisher_policy; uint8_t path_changed; int loader_optimization; uint8_t disallow_binding_redirects; uint8_t disallow_code_downloads; Il2CppObject* activation_arguments; Il2CppObject* domain_initializer; Il2CppObject* application_trust; Il2CppArray* domain_initializer_args; uint8_t disallow_appbase_probe; Il2CppArray* configuration_bytes; Il2CppArray* serialized_non_primitives; } Il2CppAppDomainSetup; typedef struct Il2CppThread { Il2CppObject obj; Il2CppInternalThread* internal_thread; Il2CppObject* start_obj; Il2CppException* pending_exception; Il2CppObject* principal; int32_t principal_version; Il2CppDelegate* delegate; Il2CppObject* executionContext; uint8_t executionContextBelongsToOuterScope; } Il2CppThread; typedef struct Il2CppException { Il2CppObject object; Il2CppString* className; Il2CppString* message; Il2CppObject* _data; struct Il2CppException* inner_ex; Il2CppString* _helpURL; Il2CppArray* trace_ips; Il2CppString* stack_trace; Il2CppString* remote_stack_trace; int remote_stack_index; Il2CppObject* _dynamicMethods; il2cpp_hresult_t hresult; Il2CppString* source; Il2CppObject* safeSerializationManager; Il2CppArray* captured_traces; Il2CppArray* native_trace_ips; } Il2CppException; typedef struct Il2CppSystemException { Il2CppException base; } Il2CppSystemException; typedef struct Il2CppArgumentException { Il2CppException base; Il2CppString* argName; } Il2CppArgumentException; typedef struct Il2CppTypedRef { const Il2CppType* type; void* value; Il2CppClass* klass; } Il2CppTypedRef; typedef struct Il2CppDelegate { Il2CppObject object; Il2CppMethodPointer method_ptr; InvokerMethod invoke_impl; Il2CppObject* target; const MethodInfo* method; void* delegate_trampoline; intptr_t extraArg; uint8_t** method_code; Il2CppReflectionMethod* method_info; Il2CppReflectionMethod* original_method_info; Il2CppObject* data; uint8_t method_is_virtual; } Il2CppDelegate; typedef struct Il2CppMulticastDelegate { Il2CppDelegate delegate; Il2CppArray* delegates; } Il2CppMulticastDelegate; typedef struct Il2CppMarshalByRefObject { Il2CppObject obj; Il2CppObject* identity; } Il2CppMarshalByRefObject; typedef struct Il2CppAppDomain { Il2CppMarshalByRefObject mbr; Il2CppDomain* data; } Il2CppAppDomain; typedef struct Il2CppStackFrame { Il2CppObject obj; int32_t il_offset; int32_t native_offset; uint64_t methodAddress; uint32_t methodIndex; Il2CppReflectionMethod* method; Il2CppString* filename; int32_t line; int32_t column; Il2CppString* internal_method_name; } Il2CppStackFrame; typedef struct Il2CppDateTimeFormatInfo { Il2CppObject obj; Il2CppObject* CultureData; Il2CppString* Name; Il2CppString* LangName; Il2CppObject* CompareInfo; Il2CppObject* CultureInfo; Il2CppString* AMDesignator; Il2CppString* PMDesignator; Il2CppString* DateSeparator; Il2CppString* GeneralShortTimePattern; Il2CppString* GeneralLongTimePattern; Il2CppString* TimeSeparator; Il2CppString* MonthDayPattern; Il2CppString* DateTimeOffsetPattern; Il2CppObject* Calendar; uint32_t FirstDayOfWeek; uint32_t CalendarWeekRule; Il2CppString* FullDateTimePattern; Il2CppArray* AbbreviatedDayNames; Il2CppArray* ShortDayNames; Il2CppArray* DayNames; Il2CppArray* AbbreviatedMonthNames; Il2CppArray* MonthNames; Il2CppArray* GenitiveMonthNames; Il2CppArray* GenitiveAbbreviatedMonthNames; Il2CppArray* LeapYearMonthNames; Il2CppString* LongDatePattern; Il2CppString* ShortDatePattern; Il2CppString* YearMonthPattern; Il2CppString* LongTimePattern; Il2CppString* ShortTimePattern; Il2CppArray* YearMonthPatterns; Il2CppArray* ShortDatePatterns; Il2CppArray* LongDatePatterns; Il2CppArray* ShortTimePatterns; Il2CppArray* LongTimePatterns; Il2CppArray* EraNames; Il2CppArray* AbbrevEraNames; Il2CppArray* AbbrevEnglishEraNames; Il2CppArray* OptionalCalendars; uint8_t readOnly; int32_t FormatFlags; int32_t CultureID; uint8_t UseUserOverride; uint8_t UseCalendarInfo; int32_t DataItem; uint8_t IsDefaultCalendar; Il2CppArray* DateWords; Il2CppString* FullTimeSpanPositivePattern; Il2CppString* FullTimeSpanNegativePattern; Il2CppArray* dtfiTokenHash; } Il2CppDateTimeFormatInfo; typedef struct Il2CppNumberFormatInfo { Il2CppObject obj; Il2CppArray* numberGroupSizes; Il2CppArray* currencyGroupSizes; Il2CppArray* percentGroupSizes; Il2CppString* positiveSign; Il2CppString* negativeSign; Il2CppString* numberDecimalSeparator; Il2CppString* numberGroupSeparator; Il2CppString* currencyGroupSeparator; Il2CppString* currencyDecimalSeparator; Il2CppString* currencySymbol; Il2CppString* ansiCurrencySymbol; Il2CppString* naNSymbol; Il2CppString* positiveInfinitySymbol; Il2CppString* negativeInfinitySymbol; Il2CppString* percentDecimalSeparator; Il2CppString* percentGroupSeparator; Il2CppString* percentSymbol; Il2CppString* perMilleSymbol; Il2CppArray* nativeDigits; int dataItem; int numberDecimalDigits; int currencyDecimalDigits; int currencyPositivePattern; int currencyNegativePattern; int numberNegativePattern; int percentPositivePattern; int percentNegativePattern; int percentDecimalDigits; int digitSubstitution; uint8_t readOnly; uint8_t useUserOverride; uint8_t isInvariant; uint8_t validForParseAsNumber; uint8_t validForParseAsCurrency; } Il2CppNumberFormatInfo; typedef struct Il2CppCultureData { Il2CppObject obj; Il2CppString* AMDesignator; Il2CppString* PMDesignator; Il2CppString* TimeSeparator; Il2CppArray* LongTimePatterns; Il2CppArray* ShortTimePatterns; uint32_t FirstDayOfWeek; uint32_t CalendarWeekRule; } Il2CppCultureData; typedef struct Il2CppCalendarData { Il2CppObject obj; Il2CppString* NativeName; Il2CppArray* ShortDatePatterns; Il2CppArray* YearMonthPatterns; Il2CppArray* LongDatePatterns; Il2CppString* MonthDayPattern; Il2CppArray* EraNames; Il2CppArray* AbbreviatedEraNames; Il2CppArray* AbbreviatedEnglishEraNames; Il2CppArray* DayNames; Il2CppArray* AbbreviatedDayNames; Il2CppArray* SuperShortDayNames; Il2CppArray* MonthNames; Il2CppArray* AbbreviatedMonthNames; Il2CppArray* GenitiveMonthNames; Il2CppArray* GenitiveAbbreviatedMonthNames; } Il2CppCalendarData; typedef struct Il2CppCultureInfo { Il2CppObject obj; uint8_t is_read_only; int32_t lcid; int32_t parent_lcid; int32_t datetime_index; int32_t number_index; int32_t default_calendar_type; uint8_t use_user_override; Il2CppNumberFormatInfo* number_format; Il2CppDateTimeFormatInfo* datetime_format; Il2CppObject* textinfo; Il2CppString* name; Il2CppString* englishname; Il2CppString* nativename; Il2CppString* iso3lang; Il2CppString* iso2lang; Il2CppString* win3lang; Il2CppString* territory; Il2CppArray* native_calendar_names; Il2CppString* compareinfo; const void* text_info_data; int dataItem; Il2CppObject* calendar; Il2CppObject* parent_culture; uint8_t constructed; Il2CppArray* cached_serialized_form; Il2CppObject* cultureData; uint8_t isInherited; } Il2CppCultureInfo; typedef struct Il2CppRegionInfo { Il2CppObject obj; int32_t geo_id; Il2CppString* iso2name; Il2CppString* iso3name; Il2CppString* win3name; Il2CppString* english_name; Il2CppString* native_name; Il2CppString* currency_symbol; Il2CppString* iso_currency_symbol; Il2CppString* currency_english_name; Il2CppString* currency_native_name; } Il2CppRegionInfo; typedef struct Il2CppSafeHandle { Il2CppObject base; void* handle; int state; uint8_t owns_handle; uint8_t fullyInitialized; } Il2CppSafeHandle; typedef struct Il2CppStringBuilder Il2CppStringBuilder; typedef struct Il2CppStringBuilder { Il2CppObject object; Il2CppArray* chunkChars; struct Il2CppStringBuilder* chunkPrevious; int chunkLength; int chunkOffset; int maxCapacity; } Il2CppStringBuilder; typedef struct Il2CppSocketAddress { Il2CppObject base; int m_Size; Il2CppArray* data; uint8_t m_changed; int m_hash; } Il2CppSocketAddress; typedef struct Il2CppSortKey { Il2CppObject base; Il2CppString* str; Il2CppArray* key; int32_t options; int32_t lcid; } Il2CppSortKey; typedef struct Il2CppErrorWrapper { Il2CppObject base; int32_t errorCode; } Il2CppErrorWrapper; typedef struct Il2CppAsyncResult { Il2CppObject base; Il2CppObject* async_state; Il2CppWaitHandle* handle; Il2CppDelegate* async_delegate; void* data; Il2CppAsyncCall* object_data; uint8_t sync_completed; uint8_t completed; uint8_t endinvoke_called; Il2CppObject* async_callback; Il2CppObject* execution_context; Il2CppObject* original_context; } Il2CppAsyncResult; typedef struct Il2CppAsyncCall { Il2CppObject base; Il2CppMethodMessage* msg; MethodInfo* cb_method; Il2CppDelegate* cb_target; Il2CppObject* state; Il2CppObject* res; Il2CppArray* out_args; } Il2CppAsyncCall; typedef struct Il2CppExceptionWrapper Il2CppExceptionWrapper; typedef struct Il2CppExceptionWrapper { Il2CppException* ex; } Il2CppExceptionWrapper; typedef struct Il2CppIOAsyncResult { Il2CppObject base; Il2CppDelegate* callback; Il2CppObject* state; Il2CppWaitHandle* wait_handle; uint8_t completed_synchronously; uint8_t completed; } Il2CppIOAsyncResult; typedef struct Il2CppSocketAsyncResult { Il2CppIOAsyncResult base; Il2CppObject* socket; int32_t operation; Il2CppException* delayedException; Il2CppObject* endPoint; Il2CppArray* buffer; int32_t offset; int32_t size; int32_t socket_flags; Il2CppObject* acceptSocket; Il2CppArray* addresses; int32_t port; Il2CppObject* buffers; uint8_t reuseSocket; int32_t currentAddress; Il2CppObject* acceptedSocket; int32_t total; int32_t error; int32_t endCalled; } Il2CppSocketAsyncResult; typedef enum Il2CppResourceLocation { IL2CPP_RESOURCE_LOCATION_EMBEDDED = 1, IL2CPP_RESOURCE_LOCATION_ANOTHER_ASSEMBLY = 2, IL2CPP_RESOURCE_LOCATION_IN_MANIFEST = 4 } Il2CppResourceLocation; typedef struct Il2CppManifestResourceInfo { Il2CppObject object; Il2CppReflectionAssembly* assembly; Il2CppString* filename; uint32_t location; } Il2CppManifestResourceInfo; typedef struct Il2CppAppContext { Il2CppObject obj; int32_t domain_id; int32_t context_id; void* static_data; } Il2CppAppContext; typedef struct Il2CppDecimal { uint16_t reserved; union { struct { uint8_t scale; uint8_t sign; } u; uint16_t signscale; } u; uint32_t Hi32; union { struct { uint32_t Lo32; uint32_t Mid32; } v; uint64_t Lo64; } v; } Il2CppDecimal; typedef struct Il2CppDouble { uint32_t mantLo : 32; uint32_t mantHi : 20; uint32_t exp : 11; uint32_t sign : 1; } Il2CppDouble; typedef union Il2CppDouble_double { Il2CppDouble s; double d; } Il2CppDouble_double; typedef enum Il2CppDecimalCompareResult { IL2CPP_DECIMAL_CMP_LT = -1, IL2CPP_DECIMAL_CMP_EQ, IL2CPP_DECIMAL_CMP_GT } Il2CppDecimalCompareResult; typedef struct Il2CppSingle { uint32_t mant : 23; uint32_t exp : 8; uint32_t sign : 1; } Il2CppSingle; typedef union Il2CppSingle_float { Il2CppSingle s; float f; } Il2CppSingle_float; ================================================ FILE: Game Trainers/common/include/il2cpp/memory.h ================================================ #pragma once #include #include class MEMORY { public: // Find a DLL module base address void *find_module(const char *name) { return (void *)GetModuleHandleA(name); } // Find a function address (exported or internal) template T find_function(void *module, const char *name) { return (T)GetProcAddress((HMODULE)module, name); } // Simple pattern scan helper (Optional, but often used in these cheats) uintptr_t find_pattern(const char *module_name, const char *pattern) { // Implementation omitted for brevity as your current code // seems to rely on GetProcAddress/IL2CPP API mostly. // If you need pattern scanning later, standard sigscan code goes here. return 0; } }; ================================================ FILE: Game Trainers/common/include/il2cpp/unity.cpp ================================================ #include "unity.h" namespace Unity { unity_GameObject_FindGameObjectsWithTag_t GameObject_FindGameObjectsWithTag; unity_GameObject_GetTransform_t GameObject_GetTransform; unity_Transform_GetPositionInjected_t Transform_GetPositionInjected; unity_Gamera_GetMain_t Gamera_GetMain; unity_Component_GetGameObject_t Component_GetGameObject; unity_Screen_GetWidth_t Screen_GetWidth; unity_Screen_GetHeight_t Screen_GetHeight; bool Initialize(MEMORY memory) { //GameObject_FindGameObjectsWithTag = find_function("UnityEngine.GameObject::FindGameObjectsWithTag(System.String)"); GameObject_FindGameObjectsWithTag = find_function("UnityEngine.GameObject::Find(System.String)"); GameObject_GetTransform = find_function("UnityEngine.GameObject::get_transform(System.IntPtr)"); Transform_GetPositionInjected = find_function("UnityEngine.Transform::get_position_Injected(UnityEngine.Vector3&)"); Gamera_GetMain = find_function("UnityEngine.Camera::get_main()"); Component_GetGameObject = find_function("UnityEngine.Component::get_gameObject()"); Screen_GetWidth = find_function("UnityEngine.Screen::get_width()"); Screen_GetHeight = find_function("UnityEngine.Screen::get_height()"); return true; } }; ================================================ FILE: Game Trainers/common/include/il2cpp/unity.h ================================================ #pragma once #include "memory.h" #include "il2cpp.h" // Unity Types struct vec3; struct Rect; struct GUIContent; struct GUIStyle; // Unity API typedef void** (__cdecl* unity_GameObject_FindGameObjectsWithTag_t)(Il2CppString*); typedef void* (__cdecl* unity_GameObject_GetTransform_t)(void*); typedef void* (__cdecl* unity_Transform_GetPositionInjected_t)(vec3&); typedef void* (__cdecl* unity_Gamera_GetMain_t)(); typedef void* (__cdecl* unity_Component_GetGameObject_t)(const char*); typedef int (__cdecl* unity_Screen_GetWidth_t)(); typedef int (__cdecl* unity_Screen_GetHeight_t)(); namespace Unity { template T find_function(const char* function_name) { return (T)IL2CPP::API::il2cpp_resolve_icall(function_name); } bool Initialize(MEMORY memory); extern unity_GameObject_FindGameObjectsWithTag_t GameObject_FindGameObjectsWithTag; extern unity_GameObject_GetTransform_t GameObject_GetTransform; extern unity_Transform_GetPositionInjected_t Transform_GetPositionInjected; extern unity_Gamera_GetMain_t Gamera_GetMain; extern unity_Component_GetGameObject_t Component_GetGameObject; extern unity_Screen_GetWidth_t Screen_GetWidth; extern unity_Screen_GetHeight_t Screen_GetHeight; }; ================================================ FILE: Game Trainers/common/include/il2cpp/vec.h ================================================ #pragma once #define _USE_MATH_DEFINES #include #include struct Vector2 { float x; float y; Vector2(float x_, float y_) { x = x_; y = y_; } }; struct Vector3 { public: Vector3() {}; Vector3(float _x, float _y, float _z) { x = _x; y = _y; z = _z; }; float Length() { return sqrt(x * x + y * y + z * z); } float Length2D() { return sqrt(x * x + y * y); } Vector2 DeltaAngle(Vector3 target) { float dx = target.x - x; float dy = target.z - z; float yaw = -atan2(dy, dx) * 180 / M_PI + 90; float distance = sqrt(dx * dx + dy * dy); float dz = target.y - y; float pitch = -atan2(dz, distance) * 180 / M_PI; return Vector2(pitch, yaw); } Vector3 operator+(Vector3 b) { return Vector3(x + b.x, y + b.y, z + b.z); } Vector3 operator-(Vector3 b) { return Vector3(x - b.x, y - b.y, z - b.z); } Vector3 operator-() { return Vector3(-x, -y, -z); } Vector3 operator*(float d) { return Vector3(x * d, y * d, z * d); } Vector3 operator/(float d) { return Vector3(x / d, y / d, z / d); } friend std::ostream& operator<<(std::ostream& os, const Vector3& v) { return os << "Vector3(" << v.x << ", " << v.y << ", " << v.z << ")"; } float x, y, z; }; ================================================ FILE: Game Trainers/common/include/nlohmann/adl_serializer.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN /// @sa https://json.nlohmann.me/api/adl_serializer/ template struct adl_serializer { /// @brief convert a JSON value to any value type /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ template static auto from_json(BasicJsonType && j, TargetType& val) noexcept( noexcept(::nlohmann::from_json(std::forward(j), val))) -> decltype(::nlohmann::from_json(std::forward(j), val), void()) { ::nlohmann::from_json(std::forward(j), val); } /// @brief convert a JSON value to any value type /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ template static auto from_json(BasicJsonType && j) noexcept( noexcept(::nlohmann::from_json(std::forward(j), detail::identity_tag {}))) -> decltype(::nlohmann::from_json(std::forward(j), detail::identity_tag {})) { return ::nlohmann::from_json(std::forward(j), detail::identity_tag {}); } /// @brief convert any value type to a JSON value /// @sa https://json.nlohmann.me/api/adl_serializer/to_json/ template static auto to_json(BasicJsonType& j, TargetType && val) noexcept( noexcept(::nlohmann::to_json(j, std::forward(val)))) -> decltype(::nlohmann::to_json(j, std::forward(val)), void()) { ::nlohmann::to_json(j, std::forward(val)); } }; NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/byte_container_with_subtype.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // uint8_t, uint64_t #include // tie #include // move #include NLOHMANN_JSON_NAMESPACE_BEGIN /// @brief an internal type for a backed binary type /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/ template class byte_container_with_subtype : public BinaryType { public: using container_type = BinaryType; using subtype_type = std::uint64_t; /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ byte_container_with_subtype() noexcept(noexcept(container_type())) : container_type() {} /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b))) : container_type(b) {} /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b)))) : container_type(std::move(b)) {} /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b))) : container_type(b) , m_subtype(subtype_) , m_has_subtype(true) {} /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ byte_container_with_subtype(container_type&& b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b)))) : container_type(std::move(b)) , m_subtype(subtype_) , m_has_subtype(true) {} bool operator==(const byte_container_with_subtype& rhs) const { return std::tie(static_cast(*this), m_subtype, m_has_subtype) == std::tie(static_cast(rhs), rhs.m_subtype, rhs.m_has_subtype); } bool operator!=(const byte_container_with_subtype& rhs) const { return !(rhs == *this); } /// @brief sets the binary subtype /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/ void set_subtype(subtype_type subtype_) noexcept { m_subtype = subtype_; m_has_subtype = true; } /// @brief return the binary subtype /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/ constexpr subtype_type subtype() const noexcept { return m_has_subtype ? m_subtype : static_cast(-1); } /// @brief return whether the value has a subtype /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/ constexpr bool has_subtype() const noexcept { return m_has_subtype; } /// @brief clears the binary subtype /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/ void clear_subtype() noexcept { m_subtype = 0; m_has_subtype = false; } private: subtype_type m_subtype = 0; bool m_has_subtype = false; }; NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/abi_macros.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once // This file contains all macro definitions affecting or depending on the ABI #ifndef JSON_SKIP_LIBRARY_VERSION_CHECK #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 #warning "Already included a different version of the library!" #endif #endif #endif #define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) #define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) #ifndef JSON_DIAGNOSTICS #define JSON_DIAGNOSTICS 0 #endif #ifndef JSON_DIAGNOSTIC_POSITIONS #define JSON_DIAGNOSTIC_POSITIONS 0 #endif #ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 #endif #if JSON_DIAGNOSTICS #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag #else #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS #endif #if JSON_DIAGNOSTIC_POSITIONS #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS _dp #else #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS #endif #if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp #else #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON #endif #ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 #endif // Construct the namespace ABI tags component #define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) json_abi ## a ## b ## c #define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b, c) \ NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) #define NLOHMANN_JSON_ABI_TAGS \ NLOHMANN_JSON_ABI_TAGS_CONCAT( \ NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON, \ NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS) // Construct the namespace version component #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ _v ## major ## _ ## minor ## _ ## patch #define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) #if NLOHMANN_JSON_NAMESPACE_NO_VERSION #define NLOHMANN_JSON_NAMESPACE_VERSION #else #define NLOHMANN_JSON_NAMESPACE_VERSION \ NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ NLOHMANN_JSON_VERSION_MINOR, \ NLOHMANN_JSON_VERSION_PATCH) #endif // Combine namespace components #define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b #define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) #ifndef NLOHMANN_JSON_NAMESPACE #define NLOHMANN_JSON_NAMESPACE \ nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) #endif #ifndef NLOHMANN_JSON_NAMESPACE_BEGIN #define NLOHMANN_JSON_NAMESPACE_BEGIN \ namespace nlohmann \ { \ inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ NLOHMANN_JSON_ABI_TAGS, \ NLOHMANN_JSON_NAMESPACE_VERSION) \ { #endif #ifndef NLOHMANN_JSON_NAMESPACE_END #define NLOHMANN_JSON_NAMESPACE_END \ } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ } // namespace nlohmann #endif ================================================ FILE: Game Trainers/common/include/nlohmann/detail/conversions/from_json.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // transform #include // array #include // forward_list #include // inserter, front_inserter, end #include // map #ifdef JSON_HAS_CPP_17 #include // optional #endif #include // string #include // tuple, make_tuple #include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible #include // unordered_map #include // pair, declval #include // valarray #include #include #include #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template inline void from_json(const BasicJsonType& j, typename std::nullptr_t& n) { if (JSON_HEDLEY_UNLIKELY(!j.is_null())) { JSON_THROW(type_error::create(302, concat("type must be null, but is ", j.type_name()), &j)); } n = nullptr; } #ifdef JSON_HAS_CPP_17 #ifndef JSON_USE_IMPLICIT_CONVERSIONS template void from_json(const BasicJsonType& j, std::optional& opt) { if (j.is_null()) { opt = std::nullopt; } else { opt.emplace(j.template get()); } } #endif // JSON_USE_IMPLICIT_CONVERSIONS #endif // JSON_HAS_CPP_17 // overloads for basic_json template parameters template < typename BasicJsonType, typename ArithmeticType, enable_if_t < std::is_arithmetic::value&& !std::is_same::value, int > = 0 > void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) { switch (static_cast(j)) { case value_t::number_unsigned: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_integer: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_float: { val = static_cast(*j.template get_ptr()); break; } case value_t::null: case value_t::object: case value_t::array: case value_t::string: case value_t::boolean: case value_t::binary: case value_t::discarded: default: JSON_THROW(type_error::create(302, concat("type must be number, but is ", j.type_name()), &j)); } } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) { if (JSON_HEDLEY_UNLIKELY(!j.is_boolean())) { JSON_THROW(type_error::create(302, concat("type must be boolean, but is ", j.type_name()), &j)); } b = *j.template get_ptr(); } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) { if (JSON_HEDLEY_UNLIKELY(!j.is_string())) { JSON_THROW(type_error::create(302, concat("type must be string, but is ", j.type_name()), &j)); } s = *j.template get_ptr(); } template < typename BasicJsonType, typename StringType, enable_if_t < std::is_assignable::value && is_detected_exact::value && !std::is_same::value && !is_json_ref::value, int > = 0 > inline void from_json(const BasicJsonType& j, StringType& s) { if (JSON_HEDLEY_UNLIKELY(!j.is_string())) { JSON_THROW(type_error::create(302, concat("type must be string, but is ", j.type_name()), &j)); } s = *j.template get_ptr(); } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val) { get_arithmetic_value(j, val); } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val) { get_arithmetic_value(j, val); } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val) { get_arithmetic_value(j, val); } #if !JSON_DISABLE_ENUM_SERIALIZATION template::value, int> = 0> inline void from_json(const BasicJsonType& j, EnumType& e) { typename std::underlying_type::type val; get_arithmetic_value(j, val); e = static_cast(val); } #endif // JSON_DISABLE_ENUM_SERIALIZATION // forward_list doesn't have an insert method template::value, int> = 0> inline void from_json(const BasicJsonType& j, std::forward_list& l) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } l.clear(); std::transform(j.rbegin(), j.rend(), std::front_inserter(l), [](const BasicJsonType & i) { return i.template get(); }); } // valarray doesn't have an insert method template::value, int> = 0> inline void from_json(const BasicJsonType& j, std::valarray& l) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } l.resize(j.size()); std::transform(j.begin(), j.end(), std::begin(l), [](const BasicJsonType & elem) { return elem.template get(); }); } template auto from_json(const BasicJsonType& j, T (&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) -> decltype(j.template get(), void()) { for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); } } template auto from_json(const BasicJsonType& j, T (&arr)[N1][N2]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) -> decltype(j.template get(), void()) { for (std::size_t i1 = 0; i1 < N1; ++i1) { for (std::size_t i2 = 0; i2 < N2; ++i2) { arr[i1][i2] = j.at(i1).at(i2).template get(); } } } template auto from_json(const BasicJsonType& j, T (&arr)[N1][N2][N3]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) -> decltype(j.template get(), void()) { for (std::size_t i1 = 0; i1 < N1; ++i1) { for (std::size_t i2 = 0; i2 < N2; ++i2) { for (std::size_t i3 = 0; i3 < N3; ++i3) { arr[i1][i2][i3] = j.at(i1).at(i2).at(i3).template get(); } } } } template auto from_json(const BasicJsonType& j, T (&arr)[N1][N2][N3][N4]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) -> decltype(j.template get(), void()) { for (std::size_t i1 = 0; i1 < N1; ++i1) { for (std::size_t i2 = 0; i2 < N2; ++i2) { for (std::size_t i3 = 0; i3 < N3; ++i3) { for (std::size_t i4 = 0; i4 < N4; ++i4) { arr[i1][i2][i3][i4] = j.at(i1).at(i2).at(i3).at(i4).template get(); } } } } } template inline void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/) { arr = *j.template get_ptr(); } template auto from_json_array_impl(const BasicJsonType& j, std::array& arr, priority_tag<2> /*unused*/) -> decltype(j.template get(), void()) { for (std::size_t i = 0; i < N; ++i) { arr[i] = j.at(i).template get(); } } template::value, int> = 0> auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/) -> decltype( arr.reserve(std::declval()), j.template get(), void()) { using std::end; ConstructibleArrayType ret; ret.reserve(j.size()); std::transform(j.begin(), j.end(), std::inserter(ret, end(ret)), [](const BasicJsonType & i) { // get() returns *this, this won't call a from_json // method when value_type is BasicJsonType return i.template get(); }); arr = std::move(ret); } template::value, int> = 0> inline void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<0> /*unused*/) { using std::end; ConstructibleArrayType ret; std::transform( j.begin(), j.end(), std::inserter(ret, end(ret)), [](const BasicJsonType & i) { // get() returns *this, this won't call a from_json // method when value_type is BasicJsonType return i.template get(); }); arr = std::move(ret); } template < typename BasicJsonType, typename ConstructibleArrayType, enable_if_t < is_constructible_array_type::value&& !is_constructible_object_type::value&& !is_constructible_string_type::value&& !std::is_same::value&& !is_basic_json::value, int > = 0 > auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr) -> decltype(from_json_array_impl(j, arr, priority_tag<3> {}), j.template get(), void()) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } from_json_array_impl(j, arr, priority_tag<3> {}); } template < typename BasicJsonType, typename T, std::size_t... Idx > std::array from_json_inplace_array_impl(BasicJsonType&& j, identity_tag> /*unused*/, index_sequence /*unused*/) { return { { std::forward(j).at(Idx).template get()... } }; } template < typename BasicJsonType, typename T, std::size_t N > auto from_json(BasicJsonType&& j, identity_tag> tag) -> decltype(from_json_inplace_array_impl(std::forward(j), tag, make_index_sequence {})) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } return from_json_inplace_array_impl(std::forward(j), tag, make_index_sequence {}); } template inline void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin) { if (JSON_HEDLEY_UNLIKELY(!j.is_binary())) { JSON_THROW(type_error::create(302, concat("type must be binary, but is ", j.type_name()), &j)); } bin = *j.template get_ptr(); } template::value, int> = 0> inline void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) { if (JSON_HEDLEY_UNLIKELY(!j.is_object())) { JSON_THROW(type_error::create(302, concat("type must be object, but is ", j.type_name()), &j)); } ConstructibleObjectType ret; const auto* inner_object = j.template get_ptr(); using value_type = typename ConstructibleObjectType::value_type; std::transform( inner_object->begin(), inner_object->end(), std::inserter(ret, ret.begin()), [](typename BasicJsonType::object_t::value_type const & p) { return value_type(p.first, p.second.template get()); }); obj = std::move(ret); } // overload for arithmetic types, not chosen for basic_json template arguments // (BooleanType, etc..); note: Is it really necessary to provide explicit // overloads for boolean_t etc. in case of a custom BooleanType which is not // an arithmetic type? template < typename BasicJsonType, typename ArithmeticType, enable_if_t < std::is_arithmetic::value&& !std::is_same::value&& !std::is_same::value&& !std::is_same::value&& !std::is_same::value, int > = 0 > inline void from_json(const BasicJsonType& j, ArithmeticType& val) { switch (static_cast(j)) { case value_t::number_unsigned: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_integer: { val = static_cast(*j.template get_ptr()); break; } case value_t::number_float: { val = static_cast(*j.template get_ptr()); break; } case value_t::boolean: { val = static_cast(*j.template get_ptr()); break; } case value_t::null: case value_t::object: case value_t::array: case value_t::string: case value_t::binary: case value_t::discarded: default: JSON_THROW(type_error::create(302, concat("type must be number, but is ", j.type_name()), &j)); } } template std::tuple from_json_tuple_impl_base(BasicJsonType&& j, index_sequence /*unused*/) { return std::make_tuple(std::forward(j).at(Idx).template get()...); } template < typename BasicJsonType, class A1, class A2 > std::pair from_json_tuple_impl(BasicJsonType&& j, identity_tag> /*unused*/, priority_tag<0> /*unused*/) { return {std::forward(j).at(0).template get(), std::forward(j).at(1).template get()}; } template inline void from_json_tuple_impl(BasicJsonType&& j, std::pair& p, priority_tag<1> /*unused*/) { p = from_json_tuple_impl(std::forward(j), identity_tag> {}, priority_tag<0> {}); } template std::tuple from_json_tuple_impl(BasicJsonType&& j, identity_tag> /*unused*/, priority_tag<2> /*unused*/) { return from_json_tuple_impl_base(std::forward(j), index_sequence_for {}); } template inline void from_json_tuple_impl(BasicJsonType&& j, std::tuple& t, priority_tag<3> /*unused*/) { t = from_json_tuple_impl_base(std::forward(j), index_sequence_for {}); } template auto from_json(BasicJsonType&& j, TupleRelated&& t) -> decltype(from_json_tuple_impl(std::forward(j), std::forward(t), priority_tag<3> {})) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } return from_json_tuple_impl(std::forward(j), std::forward(t), priority_tag<3> {}); } template < typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator, typename = enable_if_t < !std::is_constructible < typename BasicJsonType::string_t, Key >::value >> inline void from_json(const BasicJsonType& j, std::map& m) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } m.clear(); for (const auto& p : j) { if (JSON_HEDLEY_UNLIKELY(!p.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", p.type_name()), &j)); } m.emplace(p.at(0).template get(), p.at(1).template get()); } } template < typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator, typename = enable_if_t < !std::is_constructible < typename BasicJsonType::string_t, Key >::value >> inline void from_json(const BasicJsonType& j, std::unordered_map& m) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", j.type_name()), &j)); } m.clear(); for (const auto& p : j) { if (JSON_HEDLEY_UNLIKELY(!p.is_array())) { JSON_THROW(type_error::create(302, concat("type must be array, but is ", p.type_name()), &j)); } m.emplace(p.at(0).template get(), p.at(1).template get()); } } #if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM template inline void from_json(const BasicJsonType& j, std_fs::path& p) { if (JSON_HEDLEY_UNLIKELY(!j.is_string())) { JSON_THROW(type_error::create(302, concat("type must be string, but is ", j.type_name()), &j)); } p = *j.template get_ptr(); } #endif struct from_json_fn { template auto operator()(const BasicJsonType& j, T&& val) const noexcept(noexcept(from_json(j, std::forward(val)))) -> decltype(from_json(j, std::forward(val))) { return from_json(j, std::forward(val)); } }; } // namespace detail #ifndef JSON_HAS_CPP_17 /// namespace to hold default `from_json` function /// to see why this is required: /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces) { #endif JSON_INLINE_VARIABLE constexpr const auto& from_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 } // namespace #endif NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/conversions/to_chars.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2009 Florian Loitsch // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // array #include // signbit, isfinite #include // intN_t, uintN_t #include // memcpy, memmove #include // numeric_limits #include // conditional #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /*! @brief implements the Grisu2 algorithm for binary to decimal floating-point conversion. This implementation is a slightly modified version of the reference implementation which may be obtained from http://florian.loitsch.com/publications (bench.tar.gz). The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch. For a detailed description of the algorithm see: [1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with Integers", Proceedings of the ACM SIGPLAN 2010 Conference on Programming Language Design and Implementation, PLDI 2010 [2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately", Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, PLDI 1996 */ namespace dtoa_impl { template Target reinterpret_bits(const Source source) { static_assert(sizeof(Target) == sizeof(Source), "size mismatch"); Target target; std::memcpy(&target, &source, sizeof(Source)); return target; } struct diyfp // f * 2^e { static constexpr int kPrecision = 64; // = q std::uint64_t f = 0; int e = 0; constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_) {} /*! @brief returns x - y @pre x.e == y.e and x.f >= y.f */ static diyfp sub(const diyfp& x, const diyfp& y) noexcept { JSON_ASSERT(x.e == y.e); JSON_ASSERT(x.f >= y.f); return {x.f - y.f, x.e}; } /*! @brief returns x * y @note The result is rounded. (Only the upper q bits are returned.) */ static diyfp mul(const diyfp& x, const diyfp& y) noexcept { static_assert(kPrecision == 64, "internal error"); // Computes: // f = round((x.f * y.f) / 2^q) // e = x.e + y.e + q // Emulate the 64-bit * 64-bit multiplication: // // p = u * v // = (u_lo + 2^32 u_hi) (v_lo + 2^32 v_hi) // = (u_lo v_lo ) + 2^32 ((u_lo v_hi ) + (u_hi v_lo )) + 2^64 (u_hi v_hi ) // = (p0 ) + 2^32 ((p1 ) + (p2 )) + 2^64 (p3 ) // = (p0_lo + 2^32 p0_hi) + 2^32 ((p1_lo + 2^32 p1_hi) + (p2_lo + 2^32 p2_hi)) + 2^64 (p3 ) // = (p0_lo ) + 2^32 (p0_hi + p1_lo + p2_lo ) + 2^64 (p1_hi + p2_hi + p3) // = (p0_lo ) + 2^32 (Q ) + 2^64 (H ) // = (p0_lo ) + 2^32 (Q_lo + 2^32 Q_hi ) + 2^64 (H ) // // (Since Q might be larger than 2^32 - 1) // // = (p0_lo + 2^32 Q_lo) + 2^64 (Q_hi + H) // // (Q_hi + H does not overflow a 64-bit int) // // = p_lo + 2^64 p_hi const std::uint64_t u_lo = x.f & 0xFFFFFFFFu; const std::uint64_t u_hi = x.f >> 32u; const std::uint64_t v_lo = y.f & 0xFFFFFFFFu; const std::uint64_t v_hi = y.f >> 32u; const std::uint64_t p0 = u_lo * v_lo; const std::uint64_t p1 = u_lo * v_hi; const std::uint64_t p2 = u_hi * v_lo; const std::uint64_t p3 = u_hi * v_hi; const std::uint64_t p0_hi = p0 >> 32u; const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu; const std::uint64_t p1_hi = p1 >> 32u; const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu; const std::uint64_t p2_hi = p2 >> 32u; std::uint64_t Q = p0_hi + p1_lo + p2_lo; // The full product might now be computed as // // p_hi = p3 + p2_hi + p1_hi + (Q >> 32) // p_lo = p0_lo + (Q << 32) // // But in this particular case here, the full p_lo is not required. // Effectively we only need to add the highest bit in p_lo to p_hi (and // Q_hi + 1 does not overflow). Q += std::uint64_t{1} << (64u - 32u - 1u); // round, ties up const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u); return {h, x.e + y.e + 64}; } /*! @brief normalize x such that the significand is >= 2^(q-1) @pre x.f != 0 */ static diyfp normalize(diyfp x) noexcept { JSON_ASSERT(x.f != 0); while ((x.f >> 63u) == 0) { x.f <<= 1u; x.e--; } return x; } /*! @brief normalize x such that the result has the exponent E @pre e >= x.e and the upper e - x.e bits of x.f must be zero. */ static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept { const int delta = x.e - target_exponent; JSON_ASSERT(delta >= 0); JSON_ASSERT(((x.f << delta) >> delta) == x.f); return {x.f << delta, target_exponent}; } }; struct boundaries { diyfp w; diyfp minus; diyfp plus; }; /*! Compute the (normalized) diyfp representing the input number 'value' and its boundaries. @pre value must be finite and positive */ template boundaries compute_boundaries(FloatType value) { JSON_ASSERT(std::isfinite(value)); JSON_ASSERT(value > 0); // Convert the IEEE representation into a diyfp. // // If v is denormal: // value = 0.F * 2^(1 - bias) = ( F) * 2^(1 - bias - (p-1)) // If v is normalized: // value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1)) static_assert(std::numeric_limits::is_iec559, "internal error: dtoa_short requires an IEEE-754 floating-point implementation"); constexpr int kPrecision = std::numeric_limits::digits; // = p (includes the hidden bit) constexpr int kBias = std::numeric_limits::max_exponent - 1 + (kPrecision - 1); constexpr int kMinExp = 1 - kBias; constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1); // = 2^(p-1) using bits_type = typename std::conditional::type; const auto bits = static_cast(reinterpret_bits(value)); const std::uint64_t E = bits >> (kPrecision - 1); const std::uint64_t F = bits & (kHiddenBit - 1); const bool is_denormal = E == 0; const diyfp v = is_denormal ? diyfp(F, kMinExp) : diyfp(F + kHiddenBit, static_cast(E) - kBias); // Compute the boundaries m- and m+ of the floating-point value // v = f * 2^e. // // Determine v- and v+, the floating-point predecessor and successor if v, // respectively. // // v- = v - 2^e if f != 2^(p-1) or e == e_min (A) // = v - 2^(e-1) if f == 2^(p-1) and e > e_min (B) // // v+ = v + 2^e // // Let m- = (v- + v) / 2 and m+ = (v + v+) / 2. All real numbers _strictly_ // between m- and m+ round to v, regardless of how the input rounding // algorithm breaks ties. // // ---+-------------+-------------+-------------+-------------+--- (A) // v- m- v m+ v+ // // -----------------+------+------+-------------+-------------+--- (B) // v- m- v m+ v+ const bool lower_boundary_is_closer = F == 0 && E > 1; const diyfp m_plus = diyfp((2 * v.f) + 1, v.e - 1); const diyfp m_minus = lower_boundary_is_closer ? diyfp((4 * v.f) - 1, v.e - 2) // (B) : diyfp((2 * v.f) - 1, v.e - 1); // (A) // Determine the normalized w+ = m+. const diyfp w_plus = diyfp::normalize(m_plus); // Determine w- = m- such that e_(w-) = e_(w+). const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.e); return {diyfp::normalize(v), w_minus, w_plus}; } // Given normalized diyfp w, Grisu needs to find a (normalized) cached // power-of-ten c, such that the exponent of the product c * w = f * 2^e lies // within a certain range [alpha, gamma] (Definition 3.2 from [1]) // // alpha <= e = e_c + e_w + q <= gamma // // or // // f_c * f_w * 2^alpha <= f_c 2^(e_c) * f_w 2^(e_w) * 2^q // <= f_c * f_w * 2^gamma // // Since c and w are normalized, i.e. 2^(q-1) <= f < 2^q, this implies // // 2^(q-1) * 2^(q-1) * 2^alpha <= c * w * 2^q < 2^q * 2^q * 2^gamma // // or // // 2^(q - 2 + alpha) <= c * w < 2^(q + gamma) // // The choice of (alpha,gamma) determines the size of the table and the form of // the digit generation procedure. Using (alpha,gamma)=(-60,-32) works out well // in practice: // // The idea is to cut the number c * w = f * 2^e into two parts, which can be // processed independently: An integral part p1, and a fractional part p2: // // f * 2^e = ( (f div 2^-e) * 2^-e + (f mod 2^-e) ) * 2^e // = (f div 2^-e) + (f mod 2^-e) * 2^e // = p1 + p2 * 2^e // // The conversion of p1 into decimal form requires a series of divisions and // modulos by (a power of) 10. These operations are faster for 32-bit than for // 64-bit integers, so p1 should ideally fit into a 32-bit integer. This can be // achieved by choosing // // -e >= 32 or e <= -32 := gamma // // In order to convert the fractional part // // p2 * 2^e = p2 / 2^-e = d[-1] / 10^1 + d[-2] / 10^2 + ... // // into decimal form, the fraction is repeatedly multiplied by 10 and the digits // d[-i] are extracted in order: // // (10 * p2) div 2^-e = d[-1] // (10 * p2) mod 2^-e = d[-2] / 10^1 + ... // // The multiplication by 10 must not overflow. It is sufficient to choose // // 10 * p2 < 16 * p2 = 2^4 * p2 <= 2^64. // // Since p2 = f mod 2^-e < 2^-e, // // -e <= 60 or e >= -60 := alpha constexpr int kAlpha = -60; constexpr int kGamma = -32; struct cached_power // c = f * 2^e ~= 10^k { std::uint64_t f; int e; int k; }; /*! For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c satisfies (Definition 3.2 from [1]) alpha <= e_c + e + q <= gamma. */ inline cached_power get_cached_power_for_binary_exponent(int e) { // Now // // alpha <= e_c + e + q <= gamma (1) // ==> f_c * 2^alpha <= c * 2^e * 2^q // // and since the c's are normalized, 2^(q-1) <= f_c, // // ==> 2^(q - 1 + alpha) <= c * 2^(e + q) // ==> 2^(alpha - e - 1) <= c // // If c were an exact power of ten, i.e. c = 10^k, one may determine k as // // k = ceil( log_10( 2^(alpha - e - 1) ) ) // = ceil( (alpha - e - 1) * log_10(2) ) // // From the paper: // "In theory the result of the procedure could be wrong since c is rounded, // and the computation itself is approximated [...]. In practice, however, // this simple function is sufficient." // // For IEEE double precision floating-point numbers converted into // normalized diyfp's w = f * 2^e, with q = 64, // // e >= -1022 (min IEEE exponent) // -52 (p - 1) // -52 (p - 1, possibly normalize denormal IEEE numbers) // -11 (normalize the diyfp) // = -1137 // // and // // e <= +1023 (max IEEE exponent) // -52 (p - 1) // -11 (normalize the diyfp) // = 960 // // This binary exponent range [-1137,960] results in a decimal exponent // range [-307,324]. One does not need to store a cached power for each // k in this range. For each such k it suffices to find a cached power // such that the exponent of the product lies in [alpha,gamma]. // This implies that the difference of the decimal exponents of adjacent // table entries must be less than or equal to // // floor( (gamma - alpha) * log_10(2) ) = 8. // // (A smaller distance gamma-alpha would require a larger table.) // NB: // Actually this function returns c, such that -60 <= e_c + e + 64 <= -34. constexpr int kCachedPowersMinDecExp = -300; constexpr int kCachedPowersDecStep = 8; static constexpr std::array kCachedPowers = { { { 0xAB70FE17C79AC6CA, -1060, -300 }, { 0xFF77B1FCBEBCDC4F, -1034, -292 }, { 0xBE5691EF416BD60C, -1007, -284 }, { 0x8DD01FAD907FFC3C, -980, -276 }, { 0xD3515C2831559A83, -954, -268 }, { 0x9D71AC8FADA6C9B5, -927, -260 }, { 0xEA9C227723EE8BCB, -901, -252 }, { 0xAECC49914078536D, -874, -244 }, { 0x823C12795DB6CE57, -847, -236 }, { 0xC21094364DFB5637, -821, -228 }, { 0x9096EA6F3848984F, -794, -220 }, { 0xD77485CB25823AC7, -768, -212 }, { 0xA086CFCD97BF97F4, -741, -204 }, { 0xEF340A98172AACE5, -715, -196 }, { 0xB23867FB2A35B28E, -688, -188 }, { 0x84C8D4DFD2C63F3B, -661, -180 }, { 0xC5DD44271AD3CDBA, -635, -172 }, { 0x936B9FCEBB25C996, -608, -164 }, { 0xDBAC6C247D62A584, -582, -156 }, { 0xA3AB66580D5FDAF6, -555, -148 }, { 0xF3E2F893DEC3F126, -529, -140 }, { 0xB5B5ADA8AAFF80B8, -502, -132 }, { 0x87625F056C7C4A8B, -475, -124 }, { 0xC9BCFF6034C13053, -449, -116 }, { 0x964E858C91BA2655, -422, -108 }, { 0xDFF9772470297EBD, -396, -100 }, { 0xA6DFBD9FB8E5B88F, -369, -92 }, { 0xF8A95FCF88747D94, -343, -84 }, { 0xB94470938FA89BCF, -316, -76 }, { 0x8A08F0F8BF0F156B, -289, -68 }, { 0xCDB02555653131B6, -263, -60 }, { 0x993FE2C6D07B7FAC, -236, -52 }, { 0xE45C10C42A2B3B06, -210, -44 }, { 0xAA242499697392D3, -183, -36 }, { 0xFD87B5F28300CA0E, -157, -28 }, { 0xBCE5086492111AEB, -130, -20 }, { 0x8CBCCC096F5088CC, -103, -12 }, { 0xD1B71758E219652C, -77, -4 }, { 0x9C40000000000000, -50, 4 }, { 0xE8D4A51000000000, -24, 12 }, { 0xAD78EBC5AC620000, 3, 20 }, { 0x813F3978F8940984, 30, 28 }, { 0xC097CE7BC90715B3, 56, 36 }, { 0x8F7E32CE7BEA5C70, 83, 44 }, { 0xD5D238A4ABE98068, 109, 52 }, { 0x9F4F2726179A2245, 136, 60 }, { 0xED63A231D4C4FB27, 162, 68 }, { 0xB0DE65388CC8ADA8, 189, 76 }, { 0x83C7088E1AAB65DB, 216, 84 }, { 0xC45D1DF942711D9A, 242, 92 }, { 0x924D692CA61BE758, 269, 100 }, { 0xDA01EE641A708DEA, 295, 108 }, { 0xA26DA3999AEF774A, 322, 116 }, { 0xF209787BB47D6B85, 348, 124 }, { 0xB454E4A179DD1877, 375, 132 }, { 0x865B86925B9BC5C2, 402, 140 }, { 0xC83553C5C8965D3D, 428, 148 }, { 0x952AB45CFA97A0B3, 455, 156 }, { 0xDE469FBD99A05FE3, 481, 164 }, { 0xA59BC234DB398C25, 508, 172 }, { 0xF6C69A72A3989F5C, 534, 180 }, { 0xB7DCBF5354E9BECE, 561, 188 }, { 0x88FCF317F22241E2, 588, 196 }, { 0xCC20CE9BD35C78A5, 614, 204 }, { 0x98165AF37B2153DF, 641, 212 }, { 0xE2A0B5DC971F303A, 667, 220 }, { 0xA8D9D1535CE3B396, 694, 228 }, { 0xFB9B7CD9A4A7443C, 720, 236 }, { 0xBB764C4CA7A44410, 747, 244 }, { 0x8BAB8EEFB6409C1A, 774, 252 }, { 0xD01FEF10A657842C, 800, 260 }, { 0x9B10A4E5E9913129, 827, 268 }, { 0xE7109BFBA19C0C9D, 853, 276 }, { 0xAC2820D9623BF429, 880, 284 }, { 0x80444B5E7AA7CF85, 907, 292 }, { 0xBF21E44003ACDD2D, 933, 300 }, { 0x8E679C2F5E44FF8F, 960, 308 }, { 0xD433179D9C8CB841, 986, 316 }, { 0x9E19DB92B4E31BA9, 1013, 324 }, } }; // This computation gives exactly the same results for k as // k = ceil((kAlpha - e - 1) * 0.30102999566398114) // for |e| <= 1500, but doesn't require floating-point operations. // NB: log_10(2) ~= 78913 / 2^18 JSON_ASSERT(e >= -1500); JSON_ASSERT(e <= 1500); const int f = kAlpha - e - 1; const int k = ((f * 78913) / (1 << 18)) + static_cast(f > 0); const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep; JSON_ASSERT(index >= 0); JSON_ASSERT(static_cast(index) < kCachedPowers.size()); const cached_power cached = kCachedPowers[static_cast(index)]; JSON_ASSERT(kAlpha <= cached.e + e + 64); JSON_ASSERT(kGamma >= cached.e + e + 64); return cached; } /*! For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k. For n == 0, returns 1 and sets pow10 := 1. */ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10) { // LCOV_EXCL_START if (n >= 1000000000) { pow10 = 1000000000; return 10; } // LCOV_EXCL_STOP if (n >= 100000000) { pow10 = 100000000; return 9; } if (n >= 10000000) { pow10 = 10000000; return 8; } if (n >= 1000000) { pow10 = 1000000; return 7; } if (n >= 100000) { pow10 = 100000; return 6; } if (n >= 10000) { pow10 = 10000; return 5; } if (n >= 1000) { pow10 = 1000; return 4; } if (n >= 100) { pow10 = 100; return 3; } if (n >= 10) { pow10 = 10; return 2; } pow10 = 1; return 1; } inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta, std::uint64_t rest, std::uint64_t ten_k) { JSON_ASSERT(len >= 1); JSON_ASSERT(dist <= delta); JSON_ASSERT(rest <= delta); JSON_ASSERT(ten_k > 0); // <--------------------------- delta ----> // <---- dist ---------> // --------------[------------------+-------------------]-------------- // M- w M+ // // ten_k // <------> // <---- rest ----> // --------------[------------------+----+--------------]-------------- // w V // = buf * 10^k // // ten_k represents a unit-in-the-last-place in the decimal representation // stored in buf. // Decrement buf by ten_k while this takes buf closer to w. // The tests are written in this order to avoid overflow in unsigned // integer arithmetic. while (rest < dist && delta - rest >= ten_k && (rest + ten_k < dist || dist - rest > rest + ten_k - dist)) { JSON_ASSERT(buf[len - 1] != '0'); buf[len - 1]--; rest += ten_k; } } /*! Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+. M- and M+ must be normalized and share the same exponent -60 <= e <= -32. */ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, diyfp M_minus, diyfp w, diyfp M_plus) { static_assert(kAlpha >= -60, "internal error"); static_assert(kGamma <= -32, "internal error"); // Generates the digits (and the exponent) of a decimal floating-point // number V = buffer * 10^decimal_exponent in the range [M-, M+]. The diyfp's // w, M- and M+ share the same exponent e, which satisfies alpha <= e <= gamma. // // <--------------------------- delta ----> // <---- dist ---------> // --------------[------------------+-------------------]-------------- // M- w M+ // // Grisu2 generates the digits of M+ from left to right and stops as soon as // V is in [M-,M+]. JSON_ASSERT(M_plus.e >= kAlpha); JSON_ASSERT(M_plus.e <= kGamma); std::uint64_t delta = diyfp::sub(M_plus, M_minus).f; // (significand of (M+ - M-), implicit exponent is e) std::uint64_t dist = diyfp::sub(M_plus, w ).f; // (significand of (M+ - w ), implicit exponent is e) // Split M+ = f * 2^e into two parts p1 and p2 (note: e < 0): // // M+ = f * 2^e // = ((f div 2^-e) * 2^-e + (f mod 2^-e)) * 2^e // = ((p1 ) * 2^-e + (p2 )) * 2^e // = p1 + p2 * 2^e const diyfp one(std::uint64_t{1} << -M_plus.e, M_plus.e); auto p1 = static_cast(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.) std::uint64_t p2 = M_plus.f & (one.f - 1); // p2 = f mod 2^-e // 1) // // Generate the digits of the integral part p1 = d[n-1]...d[1]d[0] JSON_ASSERT(p1 > 0); std::uint32_t pow10{}; const int k = find_largest_pow10(p1, pow10); // 10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1) // // p1 = (p1 div 10^(k-1)) * 10^(k-1) + (p1 mod 10^(k-1)) // = (d[k-1] ) * 10^(k-1) + (p1 mod 10^(k-1)) // // M+ = p1 + p2 * 2^e // = d[k-1] * 10^(k-1) + (p1 mod 10^(k-1)) + p2 * 2^e // = d[k-1] * 10^(k-1) + ((p1 mod 10^(k-1)) * 2^-e + p2) * 2^e // = d[k-1] * 10^(k-1) + ( rest) * 2^e // // Now generate the digits d[n] of p1 from left to right (n = k-1,...,0) // // p1 = d[k-1]...d[n] * 10^n + d[n-1]...d[0] // // but stop as soon as // // rest * 2^e = (d[n-1]...d[0] * 2^-e + p2) * 2^e <= delta * 2^e int n = k; while (n > 0) { // Invariants: // M+ = buffer * 10^n + (p1 + p2 * 2^e) (buffer = 0 for n = k) // pow10 = 10^(n-1) <= p1 < 10^n // const std::uint32_t d = p1 / pow10; // d = p1 div 10^(n-1) const std::uint32_t r = p1 % pow10; // r = p1 mod 10^(n-1) // // M+ = buffer * 10^n + (d * 10^(n-1) + r) + p2 * 2^e // = (buffer * 10 + d) * 10^(n-1) + (r + p2 * 2^e) // JSON_ASSERT(d <= 9); buffer[length++] = static_cast('0' + d); // buffer := buffer * 10 + d // // M+ = buffer * 10^(n-1) + (r + p2 * 2^e) // p1 = r; n--; // // M+ = buffer * 10^n + (p1 + p2 * 2^e) // pow10 = 10^n // // Now check if enough digits have been generated. // Compute // // p1 + p2 * 2^e = (p1 * 2^-e + p2) * 2^e = rest * 2^e // // Note: // Since rest and delta share the same exponent e, it suffices to // compare the significands. const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2; if (rest <= delta) { // V = buffer * 10^n, with M- <= V <= M+. decimal_exponent += n; // We may now just stop. But instead look if the buffer could be // decremented to bring V closer to w. // // pow10 = 10^n is now 1 ulp in the decimal representation V. // The rounding procedure works with diyfp's with an implicit // exponent of e. // // 10^n = (10^n * 2^-e) * 2^e = ulp * 2^e // const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e; grisu2_round(buffer, length, dist, delta, rest, ten_n); return; } pow10 /= 10; // // pow10 = 10^(n-1) <= p1 < 10^n // Invariants restored. } // 2) // // The digits of the integral part have been generated: // // M+ = d[k-1]...d[1]d[0] + p2 * 2^e // = buffer + p2 * 2^e // // Now generate the digits of the fractional part p2 * 2^e. // // Note: // No decimal point is generated: the exponent is adjusted instead. // // p2 actually represents the fraction // // p2 * 2^e // = p2 / 2^-e // = d[-1] / 10^1 + d[-2] / 10^2 + ... // // Now generate the digits d[-m] of p1 from left to right (m = 1,2,...) // // p2 * 2^e = d[-1]d[-2]...d[-m] * 10^-m // + 10^-m * (d[-m-1] / 10^1 + d[-m-2] / 10^2 + ...) // // using // // 10^m * p2 = ((10^m * p2) div 2^-e) * 2^-e + ((10^m * p2) mod 2^-e) // = ( d) * 2^-e + ( r) // // or // 10^m * p2 * 2^e = d + r * 2^e // // i.e. // // M+ = buffer + p2 * 2^e // = buffer + 10^-m * (d + r * 2^e) // = (buffer * 10^m + d) * 10^-m + 10^-m * r * 2^e // // and stop as soon as 10^-m * r * 2^e <= delta * 2^e JSON_ASSERT(p2 > delta); int m = 0; for (;;) { // Invariant: // M+ = buffer * 10^-m + 10^-m * (d[-m-1] / 10 + d[-m-2] / 10^2 + ...) * 2^e // = buffer * 10^-m + 10^-m * (p2 ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e // JSON_ASSERT(p2 <= (std::numeric_limits::max)() / 10); p2 *= 10; const std::uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e const std::uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e // // M+ = buffer * 10^-m + 10^-m * (1/10 * (d * 2^-e + r) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * (d + r * 2^e)) // = (buffer * 10 + d) * 10^(-m-1) + 10^(-m-1) * r * 2^e // JSON_ASSERT(d <= 9); buffer[length++] = static_cast('0' + d); // buffer := buffer * 10 + d // // M+ = buffer * 10^(-m-1) + 10^(-m-1) * r * 2^e // p2 = r; m++; // // M+ = buffer * 10^-m + 10^-m * p2 * 2^e // Invariant restored. // Check if enough digits have been generated. // // 10^-m * p2 * 2^e <= delta * 2^e // p2 * 2^e <= 10^m * delta * 2^e // p2 <= 10^m * delta delta *= 10; dist *= 10; if (p2 <= delta) { break; } } // V = buffer * 10^-m, with M- <= V <= M+. decimal_exponent -= m; // 1 ulp in the decimal representation is now 10^-m. // Since delta and dist are now scaled by 10^m, we need to do the // same with ulp in order to keep the units in sync. // // 10^m * 10^-m = 1 = 2^-e * 2^e = ten_m * 2^e // const std::uint64_t ten_m = one.f; grisu2_round(buffer, length, dist, delta, p2, ten_m); // By construction this algorithm generates the shortest possible decimal // number (Loitsch, Theorem 6.2) which rounds back to w. // For an input number of precision p, at least // // N = 1 + ceil(p * log_10(2)) // // decimal digits are sufficient to identify all binary floating-point // numbers (Matula, "In-and-Out conversions"). // This implies that the algorithm does not produce more than N decimal // digits. // // N = 17 for p = 53 (IEEE double precision) // N = 9 for p = 24 (IEEE single precision) } /*! v = buf * 10^decimal_exponent len is the length of the buffer (number of decimal digits) The buffer must be large enough, i.e. >= max_digits10. */ JSON_HEDLEY_NON_NULL(1) inline void grisu2(char* buf, int& len, int& decimal_exponent, diyfp m_minus, diyfp v, diyfp m_plus) { JSON_ASSERT(m_plus.e == m_minus.e); JSON_ASSERT(m_plus.e == v.e); // --------(-----------------------+-----------------------)-------- (A) // m- v m+ // // --------------------(-----------+-----------------------)-------- (B) // m- v m+ // // First scale v (and m- and m+) such that the exponent is in the range // [alpha, gamma]. const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e); const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma] const diyfp w = diyfp::mul(v, c_minus_k); const diyfp w_minus = diyfp::mul(m_minus, c_minus_k); const diyfp w_plus = diyfp::mul(m_plus, c_minus_k); // ----(---+---)---------------(---+---)---------------(---+---)---- // w- w w+ // = c*m- = c*v = c*m+ // // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and // w+ are now off by a small amount. // In fact: // // w - v * 10^k < 1 ulp // // To account for this inaccuracy, add resp. subtract 1 ulp. // // --------+---[---------------(---+---)---------------]---+-------- // w- M- w M+ w+ // // Now any number in [M-, M+] (bounds included) will round to w when input, // regardless of how the input rounding algorithm breaks ties. // // And digit_gen generates the shortest possible such number in [M-, M+]. // Note that this does not mean that Grisu2 always generates the shortest // possible number in the interval (m-, m+). const diyfp M_minus(w_minus.f + 1, w_minus.e); const diyfp M_plus (w_plus.f - 1, w_plus.e ); decimal_exponent = -cached.k; // = -(-k) = k grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus); } /*! v = buf * 10^decimal_exponent len is the length of the buffer (number of decimal digits) The buffer must be large enough, i.e. >= max_digits10. */ template JSON_HEDLEY_NON_NULL(1) void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value) { static_assert(diyfp::kPrecision >= std::numeric_limits::digits + 3, "internal error: not enough precision"); JSON_ASSERT(std::isfinite(value)); JSON_ASSERT(value > 0); // If the neighbors (and boundaries) of 'value' are always computed for double-precision // numbers, all float's can be recovered using strtod (and strtof). However, the resulting // decimal representations are not exactly "short". // // The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars) // says "value is converted to a string as if by std::sprintf in the default ("C") locale" // and since sprintf promotes floats to doubles, I think this is exactly what 'std::to_chars' // does. // On the other hand, the documentation for 'std::to_chars' requires that "parsing the // representation using the corresponding std::from_chars function recovers value exactly". That // indicates that single precision floating-point numbers should be recovered using // 'std::strtof'. // // NB: If the neighbors are computed for single-precision numbers, there is a single float // (7.0385307e-26f) which can't be recovered using strtod. The resulting double precision // value is off by 1 ulp. #if 0 // NOLINT(readability-avoid-unconditional-preprocessor-if) const boundaries w = compute_boundaries(static_cast(value)); #else const boundaries w = compute_boundaries(value); #endif grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus); } /*! @brief appends a decimal representation of e to buf @return a pointer to the element following the exponent. @pre -1000 < e < 1000 */ JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_RETURNS_NON_NULL inline char* append_exponent(char* buf, int e) { JSON_ASSERT(e > -1000); JSON_ASSERT(e < 1000); if (e < 0) { e = -e; *buf++ = '-'; } else { *buf++ = '+'; } auto k = static_cast(e); if (k < 10) { // Always print at least two digits in the exponent. // This is for compatibility with printf("%g"). *buf++ = '0'; *buf++ = static_cast('0' + k); } else if (k < 100) { *buf++ = static_cast('0' + (k / 10)); k %= 10; *buf++ = static_cast('0' + k); } else { *buf++ = static_cast('0' + (k / 100)); k %= 100; *buf++ = static_cast('0' + (k / 10)); k %= 10; *buf++ = static_cast('0' + k); } return buf; } /*! @brief prettify v = buf * 10^decimal_exponent If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point notation. Otherwise it will be printed in exponential notation. @pre min_exp < 0 @pre max_exp > 0 */ JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_RETURNS_NON_NULL inline char* format_buffer(char* buf, int len, int decimal_exponent, int min_exp, int max_exp) { JSON_ASSERT(min_exp < 0); JSON_ASSERT(max_exp > 0); const int k = len; const int n = len + decimal_exponent; // v = buf * 10^(n-k) // k is the length of the buffer (number of decimal digits) // n is the position of the decimal point relative to the start of the buffer. if (k <= n && n <= max_exp) { // digits[000] // len <= max_exp + 2 std::memset(buf + k, '0', static_cast(n) - static_cast(k)); // Make it look like a floating-point number (#362, #378) buf[n + 0] = '.'; buf[n + 1] = '0'; return buf + (static_cast(n) + 2); } if (0 < n && n <= max_exp) { // dig.its // len <= max_digits10 + 1 JSON_ASSERT(k > n); std::memmove(buf + (static_cast(n) + 1), buf + n, static_cast(k) - static_cast(n)); buf[n] = '.'; return buf + (static_cast(k) + 1U); } if (min_exp < n && n <= 0) { // 0.[000]digits // len <= 2 + (-min_exp - 1) + max_digits10 std::memmove(buf + (2 + static_cast(-n)), buf, static_cast(k)); buf[0] = '0'; buf[1] = '.'; std::memset(buf + 2, '0', static_cast(-n)); return buf + (2U + static_cast(-n) + static_cast(k)); } if (k == 1) { // dE+123 // len <= 1 + 5 buf += 1; } else { // d.igitsE+123 // len <= max_digits10 + 1 + 5 std::memmove(buf + 2, buf + 1, static_cast(k) - 1); buf[1] = '.'; buf += 1 + static_cast(k); } *buf++ = 'e'; return append_exponent(buf, n - 1); } } // namespace dtoa_impl /*! @brief generates a decimal representation of the floating-point number value in [first, last). The format of the resulting decimal representation is similar to printf's %g format. Returns an iterator pointing past-the-end of the decimal representation. @note The input number must be finite, i.e. NaN's and Inf's are not supported. @note The buffer must be large enough. @note The result is NOT null-terminated. */ template JSON_HEDLEY_NON_NULL(1, 2) JSON_HEDLEY_RETURNS_NON_NULL char* to_chars(char* first, const char* last, FloatType value) { static_cast(last); // maybe unused - fix warning JSON_ASSERT(std::isfinite(value)); // Use signbit(value) instead of (value < 0) since signbit works for -0. if (std::signbit(value)) { value = -value; *first++ = '-'; } #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" #endif if (value == 0) // +-0 { *first++ = '0'; // Make it look like a floating-point number (#362, #378) *first++ = '.'; *first++ = '0'; return first; } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif JSON_ASSERT(last - first >= std::numeric_limits::max_digits10); // Compute v = buffer * 10^decimal_exponent. // The decimal digits are stored in the buffer, which needs to be interpreted // as an unsigned decimal integer. // len is the length of the buffer, i.e. the number of decimal digits. int len = 0; int decimal_exponent = 0; dtoa_impl::grisu2(first, len, decimal_exponent, value); JSON_ASSERT(len <= std::numeric_limits::max_digits10); // Format the buffer like printf("%.*g", prec, value) constexpr int kMinExp = -4; // Use digits10 here to increase compatibility with version 2. constexpr int kMaxExp = std::numeric_limits::digits10; JSON_ASSERT(last - first >= kMaxExp + 2); JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits::max_digits10); JSON_ASSERT(last - first >= std::numeric_limits::max_digits10 + 6); return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp); } } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/conversions/to_json.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // JSON_HAS_CPP_17 #ifdef JSON_HAS_CPP_17 #include // optional #endif #include // copy #include // begin, end #include // string #include // tuple, get #include // is_same, is_constructible, is_floating_point, is_enum, underlying_type #include // move, forward, declval, pair #include // valarray #include // vector #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { ////////////////// // constructors // ////////////////// /* * Note all external_constructor<>::construct functions need to call * j.m_data.m_value.destroy(j.m_data.m_type) to avoid a memory leak in case j contains an * allocated value (e.g., a string). See bug issue * https://github.com/nlohmann/json/issues/2865 for more information. */ template struct external_constructor; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::boolean; j.m_data.m_value = b; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::string; j.m_data.m_value = s; j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::string; j.m_data.m_value = std::move(s); j.assert_invariant(); } template < typename BasicJsonType, typename CompatibleStringType, enable_if_t < !std::is_same::value, int > = 0 > static void construct(BasicJsonType& j, const CompatibleStringType& str) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::string; j.m_data.m_value.string = j.template create(str); j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::binary; j.m_data.m_value = typename BasicJsonType::binary_t(b); j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::binary; j.m_data.m_value = typename BasicJsonType::binary_t(std::move(b)); j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::number_float; j.m_data.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::number_unsigned; j.m_data.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::number_integer; j.m_data.m_value = val; j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::array; j.m_data.m_value = arr; j.set_parents(); j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::array; j.m_data.m_value = std::move(arr); j.set_parents(); j.assert_invariant(); } template < typename BasicJsonType, typename CompatibleArrayType, enable_if_t < !std::is_same::value, int > = 0 > static void construct(BasicJsonType& j, const CompatibleArrayType& arr) { using std::begin; using std::end; j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::array; j.m_data.m_value.array = j.template create(begin(arr), end(arr)); j.set_parents(); j.assert_invariant(); } template static void construct(BasicJsonType& j, const std::vector& arr) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::array; j.m_data.m_value = value_t::array; j.m_data.m_value.array->reserve(arr.size()); for (const bool x : arr) { j.m_data.m_value.array->push_back(x); j.set_parent(j.m_data.m_value.array->back()); } j.assert_invariant(); } template::value, int> = 0> static void construct(BasicJsonType& j, const std::valarray& arr) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::array; j.m_data.m_value = value_t::array; j.m_data.m_value.array->resize(arr.size()); if (arr.size() > 0) { std::copy(std::begin(arr), std::end(arr), j.m_data.m_value.array->begin()); } j.set_parents(); j.assert_invariant(); } }; template<> struct external_constructor { template static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::object; j.m_data.m_value = obj; j.set_parents(); j.assert_invariant(); } template static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj) { j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::object; j.m_data.m_value = std::move(obj); j.set_parents(); j.assert_invariant(); } template < typename BasicJsonType, typename CompatibleObjectType, enable_if_t < !std::is_same::value, int > = 0 > static void construct(BasicJsonType& j, const CompatibleObjectType& obj) { using std::begin; using std::end; j.m_data.m_value.destroy(j.m_data.m_type); j.m_data.m_type = value_t::object; j.m_data.m_value.object = j.template create(begin(obj), end(obj)); j.set_parents(); j.assert_invariant(); } }; ///////////// // to_json // ///////////// #ifdef JSON_HAS_CPP_17 template::value, int> = 0> void to_json(BasicJsonType& j, const std::optional& opt) { if (opt.has_value()) { j = *opt; } else { j = nullptr; } } #endif template::value, int> = 0> inline void to_json(BasicJsonType& j, T b) noexcept { external_constructor::construct(j, b); } template < typename BasicJsonType, typename BoolRef, enable_if_t < ((std::is_same::reference, BoolRef>::value && !std::is_same ::reference, typename BasicJsonType::boolean_t&>::value) || (std::is_same::const_reference, BoolRef>::value && !std::is_same ::const_reference>, typename BasicJsonType::boolean_t >::value)) && std::is_convertible::value, int > = 0 > inline void to_json(BasicJsonType& j, const BoolRef& b) noexcept { external_constructor::construct(j, static_cast(b)); } template::value, int> = 0> inline void to_json(BasicJsonType& j, const CompatibleString& s) { external_constructor::construct(j, s); } template inline void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s) { external_constructor::construct(j, std::move(s)); } template::value, int> = 0> inline void to_json(BasicJsonType& j, FloatType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> inline void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> inline void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept { external_constructor::construct(j, static_cast(val)); } #if !JSON_DISABLE_ENUM_SERIALIZATION template::value, int> = 0> inline void to_json(BasicJsonType& j, EnumType e) noexcept { using underlying_type = typename std::underlying_type::type; static constexpr value_t integral_value_t = std::is_unsigned::value ? value_t::number_unsigned : value_t::number_integer; external_constructor::construct(j, static_cast(e)); } #endif // JSON_DISABLE_ENUM_SERIALIZATION template inline void to_json(BasicJsonType& j, const std::vector& e) { external_constructor::construct(j, e); } template < typename BasicJsonType, typename CompatibleArrayType, enable_if_t < is_compatible_array_type::value&& !is_compatible_object_type::value&& !is_compatible_string_type::value&& !std::is_same::value&& !is_basic_json::value, int > = 0 > inline void to_json(BasicJsonType& j, const CompatibleArrayType& arr) { external_constructor::construct(j, arr); } template inline void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin) { external_constructor::construct(j, bin); } template::value, int> = 0> inline void to_json(BasicJsonType& j, const std::valarray& arr) { external_constructor::construct(j, std::move(arr)); } template inline void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr) { external_constructor::construct(j, std::move(arr)); } template < typename BasicJsonType, typename CompatibleObjectType, enable_if_t < is_compatible_object_type::value&& !is_basic_json::value, int > = 0 > inline void to_json(BasicJsonType& j, const CompatibleObjectType& obj) { external_constructor::construct(j, obj); } template inline void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) { external_constructor::construct(j, std::move(obj)); } template < typename BasicJsonType, typename T, std::size_t N, enable_if_t < !std::is_constructible::value, // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) int > = 0 > inline void to_json(BasicJsonType& j, const T(&arr)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { external_constructor::construct(j, arr); } template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible::value&& std::is_constructible::value, int > = 0 > inline void to_json(BasicJsonType& j, const std::pair& p) { j = { p.first, p.second }; } // for https://github.com/nlohmann/json/pull/1134 template>::value, int> = 0> inline void to_json(BasicJsonType& j, const T& b) { j = { {b.key(), b.value()} }; } template inline void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence /*unused*/) { j = { std::get(t)... }; } template::value, int > = 0> inline void to_json(BasicJsonType& j, const T& t) { to_json_tuple_impl(j, t, make_index_sequence::value> {}); } #if JSON_HAS_FILESYSTEM || JSON_HAS_EXPERIMENTAL_FILESYSTEM template inline void to_json(BasicJsonType& j, const std_fs::path& p) { j = p.string(); } #endif struct to_json_fn { template auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward(val)))) -> decltype(to_json(j, std::forward(val)), void()) { return to_json(j, std::forward(val)); } }; } // namespace detail #ifndef JSON_HAS_CPP_17 /// namespace to hold default `to_json` function /// to see why this is required: /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html namespace // NOLINT(cert-dcl59-cpp,fuchsia-header-anon-namespaces,google-build-namespaces) { #endif JSON_INLINE_VARIABLE constexpr const auto& to_json = // NOLINT(misc-definitions-in-headers) detail::static_const::value; #ifndef JSON_HAS_CPP_17 } // namespace #endif NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/exceptions.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // nullptr_t #include // exception #if JSON_DIAGNOSTICS #include // accumulate #endif #include // runtime_error #include // to_string #include // vector #include #include #include #include #include #include #include // With -Wweak-vtables, Clang will complain about the exception classes as they // have no out-of-line virtual method definitions and their vtable will be // emitted in every translation unit. This issue cannot be fixed with a // header-only library as there is no implementation file to move these // functions to. As a result, we suppress this warning here to avoid client // code to stumble over this. See https://github.com/nlohmann/json/issues/4087 // for a discussion. #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #endif NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { //////////////// // exceptions // //////////////// /// @brief general exception of the @ref basic_json class /// @sa https://json.nlohmann.me/api/basic_json/exception/ class exception : public std::exception { public: /// returns the explanatory string const char* what() const noexcept override { return m.what(); } /// the id of the exception const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes) protected: JSON_HEDLEY_NON_NULL(3) exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing) static std::string name(const std::string& ename, int id_) { return concat("[json.exception.", ename, '.', std::to_string(id_), "] "); } static std::string diagnostics(std::nullptr_t /*leaf_element*/) { return ""; } template static std::string diagnostics(const BasicJsonType* leaf_element) { #if JSON_DIAGNOSTICS std::vector tokens; for (const auto* current = leaf_element; current != nullptr && current->m_parent != nullptr; current = current->m_parent) { switch (current->m_parent->type()) { case value_t::array: { for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i) { if (¤t->m_parent->m_data.m_value.array->operator[](i) == current) { tokens.emplace_back(std::to_string(i)); break; } } break; } case value_t::object: { for (const auto& element : *current->m_parent->m_data.m_value.object) { if (&element.second == current) { tokens.emplace_back(element.first.c_str()); break; } } break; } case value_t::null: // LCOV_EXCL_LINE case value_t::string: // LCOV_EXCL_LINE case value_t::boolean: // LCOV_EXCL_LINE case value_t::number_integer: // LCOV_EXCL_LINE case value_t::number_unsigned: // LCOV_EXCL_LINE case value_t::number_float: // LCOV_EXCL_LINE case value_t::binary: // LCOV_EXCL_LINE case value_t::discarded: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE break; // LCOV_EXCL_LINE } } if (tokens.empty()) { return ""; } auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, [](const std::string & a, const std::string & b) { return concat(a, '/', detail::escape(b)); }); return concat('(', str, ") "); #else static_cast(leaf_element); return ""; #endif } private: /// an exception object as storage for error messages std::runtime_error m; }; /// @brief exception indicating a parse error /// @sa https://json.nlohmann.me/api/basic_json/parse_error/ class parse_error : public exception { public: /*! @brief create a parse error exception @param[in] id_ the id of the exception @param[in] pos the position where the error occurred (or with chars_read_total=0 if the position cannot be determined) @param[in] what_arg the explanatory string @return parse_error object */ template::value, int> = 0> static parse_error create(int id_, const position_t& pos, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("parse_error", id_), "parse error", position_string(pos), ": ", exception::diagnostics(context), what_arg); return {id_, pos.chars_read_total, w.c_str()}; } template::value, int> = 0> static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("parse_error", id_), "parse error", (byte_ != 0 ? (concat(" at byte ", std::to_string(byte_))) : ""), ": ", exception::diagnostics(context), what_arg); return {id_, byte_, w.c_str()}; } /*! @brief byte index of the parse error The byte index of the last read character in the input file. @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). */ const std::size_t byte; private: parse_error(int id_, std::size_t byte_, const char* what_arg) : exception(id_, what_arg), byte(byte_) {} static std::string position_string(const position_t& pos) { return concat(" at line ", std::to_string(pos.lines_read + 1), ", column ", std::to_string(pos.chars_read_current_line)); } }; /// @brief exception indicating errors with iterators /// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/ class invalid_iterator : public exception { public: template::value, int> = 0> static invalid_iterator create(int id_, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("invalid_iterator", id_), exception::diagnostics(context), what_arg); return {id_, w.c_str()}; } private: JSON_HEDLEY_NON_NULL(3) invalid_iterator(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /// @brief exception indicating executing a member function with a wrong type /// @sa https://json.nlohmann.me/api/basic_json/type_error/ class type_error : public exception { public: template::value, int> = 0> static type_error create(int id_, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("type_error", id_), exception::diagnostics(context), what_arg); return {id_, w.c_str()}; } private: JSON_HEDLEY_NON_NULL(3) type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /// @brief exception indicating access out of the defined range /// @sa https://json.nlohmann.me/api/basic_json/out_of_range/ class out_of_range : public exception { public: template::value, int> = 0> static out_of_range create(int id_, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("out_of_range", id_), exception::diagnostics(context), what_arg); return {id_, w.c_str()}; } private: JSON_HEDLEY_NON_NULL(3) out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} }; /// @brief exception indicating other library errors /// @sa https://json.nlohmann.me/api/basic_json/other_error/ class other_error : public exception { public: template::value, int> = 0> static other_error create(int id_, const std::string& what_arg, BasicJsonContext context) { const std::string w = concat(exception::name("other_error", id_), exception::diagnostics(context), what_arg); return {id_, w.c_str()}; } private: JSON_HEDLEY_NON_NULL(3) other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END #if defined(__clang__) #pragma clang diagnostic pop #endif ================================================ FILE: Game Trainers/common/include/nlohmann/detail/hash.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // uint8_t #include // size_t #include // hash #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // boost::hash_combine inline std::size_t combine(std::size_t seed, std::size_t h) noexcept { seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U); return seed; } /*! @brief hash a JSON value The hash function tries to rely on std::hash where possible. Furthermore, the type of the JSON value is taken into account to have different hash values for null, 0, 0U, and false, etc. @tparam BasicJsonType basic_json specialization @param j JSON value to hash @return hash value of j */ template std::size_t hash(const BasicJsonType& j) { using string_t = typename BasicJsonType::string_t; using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; const auto type = static_cast(j.type()); switch (j.type()) { case BasicJsonType::value_t::null: case BasicJsonType::value_t::discarded: { return combine(type, 0); } case BasicJsonType::value_t::object: { auto seed = combine(type, j.size()); for (const auto& element : j.items()) { const auto h = std::hash {}(element.key()); seed = combine(seed, h); seed = combine(seed, hash(element.value())); } return seed; } case BasicJsonType::value_t::array: { auto seed = combine(type, j.size()); for (const auto& element : j) { seed = combine(seed, hash(element)); } return seed; } case BasicJsonType::value_t::string: { const auto h = std::hash {}(j.template get_ref()); return combine(type, h); } case BasicJsonType::value_t::boolean: { const auto h = std::hash {}(j.template get()); return combine(type, h); } case BasicJsonType::value_t::number_integer: { const auto h = std::hash {}(j.template get()); return combine(type, h); } case BasicJsonType::value_t::number_unsigned: { const auto h = std::hash {}(j.template get()); return combine(type, h); } case BasicJsonType::value_t::number_float: { const auto h = std::hash {}(j.template get()); return combine(type, h); } case BasicJsonType::value_t::binary: { auto seed = combine(type, j.get_binary().size()); const auto h = std::hash {}(j.get_binary().has_subtype()); seed = combine(seed, h); seed = combine(seed, static_cast(j.get_binary().subtype())); for (const auto byte : j.get_binary()) { seed = combine(seed, std::hash {}(byte)); } return seed; } default: // LCOV_EXCL_LINE JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE return 0; // LCOV_EXCL_LINE } } } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/binary_reader.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // generate_n #include // array #include // ldexp #include // size_t #include // uint8_t, uint16_t, uint32_t, uint64_t #include // snprintf #include // memcpy #include // back_inserter #include // numeric_limits #include // char_traits, string #include // make_pair, move #include // vector #ifdef __cpp_lib_byteswap #include //byteswap #endif #include #include #include #include #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /// how to treat CBOR tags enum class cbor_tag_handler_t { error, ///< throw a parse_error exception in case of a tag ignore, ///< ignore tags store ///< store tags as binary type }; /*! @brief determine system byte order @return true if and only if system's byte order is little endian @note from https://stackoverflow.com/a/1001328/266378 */ static inline bool little_endianness(int num = 1) noexcept { return *reinterpret_cast(&num) == 1; } /////////////////// // binary reader // /////////////////// /*! @brief deserialization of CBOR, MessagePack, and UBJSON values */ template> class binary_reader { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; using json_sax_t = SAX; using char_type = typename InputAdapterType::char_type; using char_int_type = typename char_traits::int_type; public: /*! @brief create a binary reader @param[in] adapter input adapter to read from */ explicit binary_reader(InputAdapterType&& adapter, const input_format_t format = input_format_t::json) noexcept : ia(std::move(adapter)), input_format(format) { (void)detail::is_sax_static_asserts {}; } // make class move-only binary_reader(const binary_reader&) = delete; binary_reader(binary_reader&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) binary_reader& operator=(const binary_reader&) = delete; binary_reader& operator=(binary_reader&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) ~binary_reader() = default; /*! @param[in] format the binary format to parse @param[in] sax_ a SAX event processor @param[in] strict whether to expect the input to be consumed completed @param[in] tag_handler how to treat CBOR tags @return whether parsing was successful */ JSON_HEDLEY_NON_NULL(3) bool sax_parse(const input_format_t format, json_sax_t* sax_, const bool strict = true, const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { sax = sax_; bool result = false; switch (format) { case input_format_t::bson: result = parse_bson_internal(); break; case input_format_t::cbor: result = parse_cbor_internal(true, tag_handler); break; case input_format_t::msgpack: result = parse_msgpack_internal(); break; case input_format_t::ubjson: case input_format_t::bjdata: result = parse_ubjson_internal(); break; case input_format_t::json: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE } // strict mode: next byte must be EOF if (result && strict) { if (input_format == input_format_t::ubjson || input_format == input_format_t::bjdata) { get_ignore_noop(); } else { get(); } if (JSON_HEDLEY_UNLIKELY(current != char_traits::eof())) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(110, chars_read, exception_message(input_format, concat("expected end of input; last byte: 0x", get_token_string()), "value"), nullptr)); } } return result; } private: ////////// // BSON // ////////// /*! @brief Reads in a BSON-object and passes it to the SAX-parser. @return whether a valid BSON-value was passed to the SAX parser */ bool parse_bson_internal() { std::int32_t document_size{}; get_number(input_format_t::bson, document_size); if (JSON_HEDLEY_UNLIKELY(!sax->start_object(detail::unknown_size()))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/false))) { return false; } return sax->end_object(); } /*! @brief Parses a C-style string from the BSON input. @param[in,out] result A reference to the string variable where the read string is to be stored. @return `true` if the \x00-byte indicating the end of the string was encountered before the EOF; false` indicates an unexpected EOF. */ bool get_bson_cstr(string_t& result) { auto out = std::back_inserter(result); while (true) { get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, "cstring"))) { return false; } if (current == 0x00) { return true; } *out++ = static_cast(current); } } /*! @brief Parses a zero-terminated string of length @a len from the BSON input. @param[in] len The length (including the zero-byte at the end) of the string to be read. @param[in,out] result A reference to the string variable where the read string is to be stored. @tparam NumberType The type of the length @a len @pre len >= 1 @return `true` if the string was successfully parsed */ template bool get_bson_string(const NumberType len, string_t& result) { if (JSON_HEDLEY_UNLIKELY(len < 1)) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, concat("string length must be at least 1, is ", std::to_string(len)), "string"), nullptr)); } return get_string(input_format_t::bson, len - static_cast(1), result) && get() != char_traits::eof(); } /*! @brief Parses a byte array input of length @a len from the BSON input. @param[in] len The length of the byte array to be read. @param[in,out] result A reference to the binary variable where the read array is to be stored. @tparam NumberType The type of the length @a len @pre len >= 0 @return `true` if the byte array was successfully parsed */ template bool get_bson_binary(const NumberType len, binary_t& result) { if (JSON_HEDLEY_UNLIKELY(len < 0)) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, concat("byte array length cannot be negative, is ", std::to_string(len)), "binary"), nullptr)); } // All BSON binary values have a subtype std::uint8_t subtype{}; get_number(input_format_t::bson, subtype); result.set_subtype(subtype); return get_binary(input_format_t::bson, len, result); } /*! @brief Read a BSON document element of the given @a element_type. @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html @param[in] element_type_parse_position The position in the input stream, where the `element_type` was read. @warning Not all BSON element types are supported yet. An unsupported @a element_type will give rise to a parse_error.114: Unsupported BSON record type 0x... @return whether a valid BSON-object/array was passed to the SAX parser */ bool parse_bson_element_internal(const char_int_type element_type, const std::size_t element_type_parse_position) { switch (element_type) { case 0x01: // double { double number{}; return get_number(input_format_t::bson, number) && sax->number_float(static_cast(number), ""); } case 0x02: // string { std::int32_t len{}; string_t value; return get_number(input_format_t::bson, len) && get_bson_string(len, value) && sax->string(value); } case 0x03: // object { return parse_bson_internal(); } case 0x04: // array { return parse_bson_array(); } case 0x05: // binary { std::int32_t len{}; binary_t value; return get_number(input_format_t::bson, len) && get_bson_binary(len, value) && sax->binary(value); } case 0x08: // boolean { return sax->boolean(get() != 0); } case 0x0A: // null { return sax->null(); } case 0x10: // int32 { std::int32_t value{}; return get_number(input_format_t::bson, value) && sax->number_integer(value); } case 0x12: // int64 { std::int64_t value{}; return get_number(input_format_t::bson, value) && sax->number_integer(value); } default: // anything else not supported (yet) { std::array cr{{}}; static_cast((std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(element_type))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) const std::string cr_str{cr.data()}; return sax->parse_error(element_type_parse_position, cr_str, parse_error::create(114, element_type_parse_position, concat("Unsupported BSON record type 0x", cr_str), nullptr)); } } } /*! @brief Read a BSON element list (as specified in the BSON-spec) The same binary layout is used for objects and arrays, hence it must be indicated with the argument @a is_array which one is expected (true --> array, false --> object). @param[in] is_array Determines if the element list being read is to be treated as an object (@a is_array == false), or as an array (@a is_array == true). @return whether a valid BSON-object/array was passed to the SAX parser */ bool parse_bson_element_list(const bool is_array) { string_t key; while (auto element_type = get()) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::bson, "element list"))) { return false; } const std::size_t element_type_parse_position = chars_read; if (JSON_HEDLEY_UNLIKELY(!get_bson_cstr(key))) { return false; } if (!is_array && !sax->key(key)) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_internal(element_type, element_type_parse_position))) { return false; } // get_bson_cstr only appends key.clear(); } return true; } /*! @brief Reads an array from the BSON input and passes it to the SAX-parser. @return whether a valid BSON-array was passed to the SAX parser */ bool parse_bson_array() { std::int32_t document_size{}; get_number(input_format_t::bson, document_size); if (JSON_HEDLEY_UNLIKELY(!sax->start_array(detail::unknown_size()))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/true))) { return false; } return sax->end_array(); } ////////// // CBOR // ////////// /*! @param[in] get_char whether a new character should be retrieved from the input (true) or whether the last read character should be considered instead (false) @param[in] tag_handler how CBOR tags should be treated @return whether a valid CBOR value was passed to the SAX parser */ bool parse_cbor_internal(const bool get_char, const cbor_tag_handler_t tag_handler) { switch (get_char ? get() : current) { // EOF case char_traits::eof(): return unexpect_eof(input_format_t::cbor, "value"); // Integer 0x00..0x17 (0..23) case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: return sax->number_unsigned(static_cast(current)); case 0x18: // Unsigned integer (one-byte uint8_t follows) { std::uint8_t number{}; return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); } case 0x19: // Unsigned integer (two-byte uint16_t follows) { std::uint16_t number{}; return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); } case 0x1A: // Unsigned integer (four-byte uint32_t follows) { std::uint32_t number{}; return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); } case 0x1B: // Unsigned integer (eight-byte uint64_t follows) { std::uint64_t number{}; return get_number(input_format_t::cbor, number) && sax->number_unsigned(number); } // Negative integer -1-0x00..-1-0x17 (-1..-24) case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: return sax->number_integer(static_cast(0x20 - 1 - current)); case 0x38: // Negative integer (one-byte uint8_t follows) { std::uint8_t number{}; return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); } case 0x39: // Negative integer -1-n (two-byte uint16_t follows) { std::uint16_t number{}; return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); } case 0x3A: // Negative integer -1-n (four-byte uint32_t follows) { std::uint32_t number{}; return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); } case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows) { std::uint64_t number{}; return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - static_cast(number)); } // Binary data (0x00..0x17 bytes follow) case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: // Binary data (one-byte uint8_t for n follows) case 0x59: // Binary data (two-byte uint16_t for n follow) case 0x5A: // Binary data (four-byte uint32_t for n follow) case 0x5B: // Binary data (eight-byte uint64_t for n follow) case 0x5F: // Binary data (indefinite length) { binary_t b; return get_cbor_binary(b) && sax->binary(b); } // UTF-8 string (0x00..0x17 bytes follow) case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: // UTF-8 string (one-byte uint8_t for n follows) case 0x79: // UTF-8 string (two-byte uint16_t for n follow) case 0x7A: // UTF-8 string (four-byte uint32_t for n follow) case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow) case 0x7F: // UTF-8 string (indefinite length) { string_t s; return get_cbor_string(s) && sax->string(s); } // array (0x00..0x17 data items follow) case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: return get_cbor_array( conditional_static_cast(static_cast(current) & 0x1Fu), tag_handler); case 0x98: // array (one-byte uint8_t for n follows) { std::uint8_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); } case 0x99: // array (two-byte uint16_t for n follow) { std::uint16_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); } case 0x9A: // array (four-byte uint32_t for n follow) { std::uint32_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_array(conditional_static_cast(len), tag_handler); } case 0x9B: // array (eight-byte uint64_t for n follow) { std::uint64_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_array(conditional_static_cast(len), tag_handler); } case 0x9F: // array (indefinite length) return get_cbor_array(detail::unknown_size(), tag_handler); // map (0x00..0x17 pairs of data items follow) case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: return get_cbor_object(conditional_static_cast(static_cast(current) & 0x1Fu), tag_handler); case 0xB8: // map (one-byte uint8_t for n follows) { std::uint8_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); } case 0xB9: // map (two-byte uint16_t for n follow) { std::uint16_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); } case 0xBA: // map (four-byte uint32_t for n follow) { std::uint32_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_object(conditional_static_cast(len), tag_handler); } case 0xBB: // map (eight-byte uint64_t for n follow) { std::uint64_t len{}; return get_number(input_format_t::cbor, len) && get_cbor_object(conditional_static_cast(len), tag_handler); } case 0xBF: // map (indefinite length) return get_cbor_object(detail::unknown_size(), tag_handler); case 0xC6: // tagged item case 0xC7: case 0xC8: case 0xC9: case 0xCA: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xD2: case 0xD3: case 0xD4: case 0xD8: // tagged item (1 bytes follow) case 0xD9: // tagged item (2 bytes follow) case 0xDA: // tagged item (4 bytes follow) case 0xDB: // tagged item (8 bytes follow) { switch (tag_handler) { case cbor_tag_handler_t::error: { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, concat("invalid byte: 0x", last_token), "value"), nullptr)); } case cbor_tag_handler_t::ignore: { // ignore binary subtype switch (current) { case 0xD8: { std::uint8_t subtype_to_ignore{}; get_number(input_format_t::cbor, subtype_to_ignore); break; } case 0xD9: { std::uint16_t subtype_to_ignore{}; get_number(input_format_t::cbor, subtype_to_ignore); break; } case 0xDA: { std::uint32_t subtype_to_ignore{}; get_number(input_format_t::cbor, subtype_to_ignore); break; } case 0xDB: { std::uint64_t subtype_to_ignore{}; get_number(input_format_t::cbor, subtype_to_ignore); break; } default: break; } return parse_cbor_internal(true, tag_handler); } case cbor_tag_handler_t::store: { binary_t b; // use binary subtype and store in binary container switch (current) { case 0xD8: { std::uint8_t subtype{}; get_number(input_format_t::cbor, subtype); b.set_subtype(detail::conditional_static_cast(subtype)); break; } case 0xD9: { std::uint16_t subtype{}; get_number(input_format_t::cbor, subtype); b.set_subtype(detail::conditional_static_cast(subtype)); break; } case 0xDA: { std::uint32_t subtype{}; get_number(input_format_t::cbor, subtype); b.set_subtype(detail::conditional_static_cast(subtype)); break; } case 0xDB: { std::uint64_t subtype{}; get_number(input_format_t::cbor, subtype); b.set_subtype(detail::conditional_static_cast(subtype)); break; } default: return parse_cbor_internal(true, tag_handler); } get(); return get_cbor_binary(b) && sax->binary(b); } default: // LCOV_EXCL_LINE JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE return false; // LCOV_EXCL_LINE } } case 0xF4: // false return sax->boolean(false); case 0xF5: // true return sax->boolean(true); case 0xF6: // null return sax->null(); case 0xF9: // Half-Precision Float (two-byte IEEE 754) { const auto byte1_raw = get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "number"))) { return false; } const auto byte2_raw = get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "number"))) { return false; } const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); // code from RFC 7049, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very // easy to include at least decoding support for them even // without such support. An example of a small decoder for // half-precision floating-point numbers in the C language // is shown in Fig. 3. const auto half = static_cast((byte1 << 8u) + byte2); const double val = [&half] { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; JSON_ASSERT(0 <= exp&& exp <= 32); JSON_ASSERT(mant <= 1024); switch (exp) { case 0: return std::ldexp(mant, -24); case 31: return (mant == 0) ? std::numeric_limits::infinity() : std::numeric_limits::quiet_NaN(); default: return std::ldexp(mant + 1024, exp - 25); } }(); return sax->number_float((half & 0x8000u) != 0 ? static_cast(-val) : static_cast(val), ""); } case 0xFA: // Single-Precision Float (four-byte IEEE 754) { float number{}; return get_number(input_format_t::cbor, number) && sax->number_float(static_cast(number), ""); } case 0xFB: // Double-Precision Float (eight-byte IEEE 754) { double number{}; return get_number(input_format_t::cbor, number) && sax->number_float(static_cast(number), ""); } default: // anything else (0xFF is handled inside the other types) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, concat("invalid byte: 0x", last_token), "value"), nullptr)); } } } /*! @brief reads a CBOR string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. Additionally, CBOR's strings with indefinite lengths are supported. @param[out] result created string @return whether string creation completed */ bool get_cbor_string(string_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "string"))) { return false; } switch (current) { // UTF-8 string (0x00..0x17 bytes follow) case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: { return get_string(input_format_t::cbor, static_cast(current) & 0x1Fu, result); } case 0x78: // UTF-8 string (one-byte uint8_t for n follows) { std::uint8_t len{}; return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result); } case 0x79: // UTF-8 string (two-byte uint16_t for n follow) { std::uint16_t len{}; return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result); } case 0x7A: // UTF-8 string (four-byte uint32_t for n follow) { std::uint32_t len{}; return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result); } case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow) { std::uint64_t len{}; return get_number(input_format_t::cbor, len) && get_string(input_format_t::cbor, len, result); } case 0x7F: // UTF-8 string (indefinite length) { while (get() != 0xFF) { string_t chunk; if (!get_cbor_string(chunk)) { return false; } result.append(chunk); } return true; } default: { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, concat("expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x", last_token), "string"), nullptr)); } } } /*! @brief reads a CBOR byte array This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into the byte array. Additionally, CBOR's byte arrays with indefinite lengths are supported. @param[out] result created byte array @return whether byte array creation completed */ bool get_cbor_binary(binary_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary"))) { return false; } switch (current) { // Binary data (0x00..0x17 bytes follow) case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: { return get_binary(input_format_t::cbor, static_cast(current) & 0x1Fu, result); } case 0x58: // Binary data (one-byte uint8_t for n follows) { std::uint8_t len{}; return get_number(input_format_t::cbor, len) && get_binary(input_format_t::cbor, len, result); } case 0x59: // Binary data (two-byte uint16_t for n follow) { std::uint16_t len{}; return get_number(input_format_t::cbor, len) && get_binary(input_format_t::cbor, len, result); } case 0x5A: // Binary data (four-byte uint32_t for n follow) { std::uint32_t len{}; return get_number(input_format_t::cbor, len) && get_binary(input_format_t::cbor, len, result); } case 0x5B: // Binary data (eight-byte uint64_t for n follow) { std::uint64_t len{}; return get_number(input_format_t::cbor, len) && get_binary(input_format_t::cbor, len, result); } case 0x5F: // Binary data (indefinite length) { while (get() != 0xFF) { binary_t chunk; if (!get_cbor_binary(chunk)) { return false; } result.insert(result.end(), chunk.begin(), chunk.end()); } return true; } default: { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, concat("expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x", last_token), "binary"), nullptr)); } } } /*! @param[in] len the length of the array or detail::unknown_size() for an array of indefinite size @param[in] tag_handler how CBOR tags should be treated @return whether array creation completed */ bool get_cbor_array(const std::size_t len, const cbor_tag_handler_t tag_handler) { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len))) { return false; } if (len != detail::unknown_size()) { for (std::size_t i = 0; i < len; ++i) { if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) { return false; } } } else { while (get() != 0xFF) { if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(false, tag_handler))) { return false; } } } return sax->end_array(); } /*! @param[in] len the length of the object or detail::unknown_size() for an object of indefinite size @param[in] tag_handler how CBOR tags should be treated @return whether object creation completed */ bool get_cbor_object(const std::size_t len, const cbor_tag_handler_t tag_handler) { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) { return false; } if (len != 0) { string_t key; if (len != detail::unknown_size()) { for (std::size_t i = 0; i < len; ++i) { get(); if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) { return false; } key.clear(); } } else { while (get() != 0xFF) { if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler))) { return false; } key.clear(); } } } return sax->end_object(); } ///////////// // MsgPack // ///////////// /*! @return whether a valid MessagePack value was passed to the SAX parser */ bool parse_msgpack_internal() { switch (get()) { // EOF case char_traits::eof(): return unexpect_eof(input_format_t::msgpack, "value"); // positive fixint case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0A: case 0x0B: case 0x0C: case 0x0D: case 0x0E: case 0x0F: case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1A: case 0x1B: case 0x1C: case 0x1D: case 0x1E: case 0x1F: case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F: case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5A: case 0x5B: case 0x5C: case 0x5D: case 0x5E: case 0x5F: case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7A: case 0x7B: case 0x7C: case 0x7D: case 0x7E: case 0x7F: return sax->number_unsigned(static_cast(current)); // fixmap case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: return get_msgpack_object(conditional_static_cast(static_cast(current) & 0x0Fu)); // fixarray case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: case 0x98: case 0x99: case 0x9A: case 0x9B: case 0x9C: case 0x9D: case 0x9E: case 0x9F: return get_msgpack_array(conditional_static_cast(static_cast(current) & 0x0Fu)); // fixstr case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: case 0xD9: // str 8 case 0xDA: // str 16 case 0xDB: // str 32 { string_t s; return get_msgpack_string(s) && sax->string(s); } case 0xC0: // nil return sax->null(); case 0xC2: // false return sax->boolean(false); case 0xC3: // true return sax->boolean(true); case 0xC4: // bin 8 case 0xC5: // bin 16 case 0xC6: // bin 32 case 0xC7: // ext 8 case 0xC8: // ext 16 case 0xC9: // ext 32 case 0xD4: // fixext 1 case 0xD5: // fixext 2 case 0xD6: // fixext 4 case 0xD7: // fixext 8 case 0xD8: // fixext 16 { binary_t b; return get_msgpack_binary(b) && sax->binary(b); } case 0xCA: // float 32 { float number{}; return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast(number), ""); } case 0xCB: // float 64 { double number{}; return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast(number), ""); } case 0xCC: // uint 8 { std::uint8_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number); } case 0xCD: // uint 16 { std::uint16_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number); } case 0xCE: // uint 32 { std::uint32_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number); } case 0xCF: // uint 64 { std::uint64_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_unsigned(number); } case 0xD0: // int 8 { std::int8_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_integer(number); } case 0xD1: // int 16 { std::int16_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_integer(number); } case 0xD2: // int 32 { std::int32_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_integer(number); } case 0xD3: // int 64 { std::int64_t number{}; return get_number(input_format_t::msgpack, number) && sax->number_integer(number); } case 0xDC: // array 16 { std::uint16_t len{}; return get_number(input_format_t::msgpack, len) && get_msgpack_array(static_cast(len)); } case 0xDD: // array 32 { std::uint32_t len{}; return get_number(input_format_t::msgpack, len) && get_msgpack_array(conditional_static_cast(len)); } case 0xDE: // map 16 { std::uint16_t len{}; return get_number(input_format_t::msgpack, len) && get_msgpack_object(static_cast(len)); } case 0xDF: // map 32 { std::uint32_t len{}; return get_number(input_format_t::msgpack, len) && get_msgpack_object(conditional_static_cast(len)); } // negative fixint case 0xE0: case 0xE1: case 0xE2: case 0xE3: case 0xE4: case 0xE5: case 0xE6: case 0xE7: case 0xE8: case 0xE9: case 0xEA: case 0xEB: case 0xEC: case 0xED: case 0xEE: case 0xEF: case 0xF0: case 0xF1: case 0xF2: case 0xF3: case 0xF4: case 0xF5: case 0xF6: case 0xF7: case 0xF8: case 0xF9: case 0xFA: case 0xFB: case 0xFC: case 0xFD: case 0xFE: case 0xFF: return sax->number_integer(static_cast(current)); default: // anything else { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::msgpack, concat("invalid byte: 0x", last_token), "value"), nullptr)); } } } /*! @brief reads a MessagePack string This function first reads starting bytes to determine the expected string length and then copies this number of bytes into a string. @param[out] result created string @return whether string creation completed */ bool get_msgpack_string(string_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, "string"))) { return false; } switch (current) { // fixstr case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: case 0xB8: case 0xB9: case 0xBA: case 0xBB: case 0xBC: case 0xBD: case 0xBE: case 0xBF: { return get_string(input_format_t::msgpack, static_cast(current) & 0x1Fu, result); } case 0xD9: // str 8 { std::uint8_t len{}; return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result); } case 0xDA: // str 16 { std::uint16_t len{}; return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result); } case 0xDB: // str 32 { std::uint32_t len{}; return get_number(input_format_t::msgpack, len) && get_string(input_format_t::msgpack, len, result); } default: { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::msgpack, concat("expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x", last_token), "string"), nullptr)); } } } /*! @brief reads a MessagePack byte array This function first reads starting bytes to determine the expected byte array length and then copies this number of bytes into a byte array. @param[out] result created byte array @return whether byte array creation completed */ bool get_msgpack_binary(binary_t& result) { // helper function to set the subtype auto assign_and_return_true = [&result](std::int8_t subtype) { result.set_subtype(static_cast(subtype)); return true; }; switch (current) { case 0xC4: // bin 8 { std::uint8_t len{}; return get_number(input_format_t::msgpack, len) && get_binary(input_format_t::msgpack, len, result); } case 0xC5: // bin 16 { std::uint16_t len{}; return get_number(input_format_t::msgpack, len) && get_binary(input_format_t::msgpack, len, result); } case 0xC6: // bin 32 { std::uint32_t len{}; return get_number(input_format_t::msgpack, len) && get_binary(input_format_t::msgpack, len, result); } case 0xC7: // ext 8 { std::uint8_t len{}; std::int8_t subtype{}; return get_number(input_format_t::msgpack, len) && get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, len, result) && assign_and_return_true(subtype); } case 0xC8: // ext 16 { std::uint16_t len{}; std::int8_t subtype{}; return get_number(input_format_t::msgpack, len) && get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, len, result) && assign_and_return_true(subtype); } case 0xC9: // ext 32 { std::uint32_t len{}; std::int8_t subtype{}; return get_number(input_format_t::msgpack, len) && get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, len, result) && assign_and_return_true(subtype); } case 0xD4: // fixext 1 { std::int8_t subtype{}; return get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, 1, result) && assign_and_return_true(subtype); } case 0xD5: // fixext 2 { std::int8_t subtype{}; return get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, 2, result) && assign_and_return_true(subtype); } case 0xD6: // fixext 4 { std::int8_t subtype{}; return get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, 4, result) && assign_and_return_true(subtype); } case 0xD7: // fixext 8 { std::int8_t subtype{}; return get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, 8, result) && assign_and_return_true(subtype); } case 0xD8: // fixext 16 { std::int8_t subtype{}; return get_number(input_format_t::msgpack, subtype) && get_binary(input_format_t::msgpack, 16, result) && assign_and_return_true(subtype); } default: // LCOV_EXCL_LINE return false; // LCOV_EXCL_LINE } } /*! @param[in] len the length of the array @return whether array creation completed */ bool get_msgpack_array(const std::size_t len) { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len))) { return false; } for (std::size_t i = 0; i < len; ++i) { if (JSON_HEDLEY_UNLIKELY(!parse_msgpack_internal())) { return false; } } return sax->end_array(); } /*! @param[in] len the length of the object @return whether object creation completed */ bool get_msgpack_object(const std::size_t len) { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) { return false; } string_t key; for (std::size_t i = 0; i < len; ++i) { get(); if (JSON_HEDLEY_UNLIKELY(!get_msgpack_string(key) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_msgpack_internal())) { return false; } key.clear(); } return sax->end_object(); } //////////// // UBJSON // //////////// /*! @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead @return whether a valid UBJSON value was passed to the SAX parser */ bool parse_ubjson_internal(const bool get_char = true) { return get_ubjson_value(get_char ? get_ignore_noop() : current); } /*! @brief reads a UBJSON string This function is either called after reading the 'S' byte explicitly indicating a string, or in case of an object key where the 'S' byte can be left out. @param[out] result created string @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead @return whether string creation completed */ bool get_ubjson_string(string_t& result, const bool get_char = true) { if (get_char) { get(); // TODO(niels): may we ignore N here? } if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "value"))) { return false; } switch (current) { case 'U': { std::uint8_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'i': { std::int8_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'I': { std::int16_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'l': { std::int32_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'L': { std::int64_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'u': { if (input_format != input_format_t::bjdata) { break; } std::uint16_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'm': { if (input_format != input_format_t::bjdata) { break; } std::uint32_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } case 'M': { if (input_format != input_format_t::bjdata) { break; } std::uint64_t len{}; return get_number(input_format, len) && get_string(input_format, len, result); } default: break; } auto last_token = get_token_string(); std::string message; if (input_format != input_format_t::bjdata) { message = "expected length type specification (U, i, I, l, L); last byte: 0x" + last_token; } else { message = "expected length type specification (U, i, u, I, m, l, M, L); last byte: 0x" + last_token; } return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format, message, "string"), nullptr)); } /*! @param[out] dim an integer vector storing the ND array dimensions @return whether reading ND array size vector is successful */ bool get_ubjson_ndarray_size(std::vector& dim) { std::pair size_and_type; size_t dimlen = 0; bool no_ndarray = true; if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type, no_ndarray))) { return false; } if (size_and_type.first != npos) { if (size_and_type.second != 0) { if (size_and_type.second != 'N') { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_value(dimlen, no_ndarray, size_and_type.second))) { return false; } dim.push_back(dimlen); } } } else { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_value(dimlen, no_ndarray))) { return false; } dim.push_back(dimlen); } } } else { while (current != ']') { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_value(dimlen, no_ndarray, current))) { return false; } dim.push_back(dimlen); get_ignore_noop(); } } return true; } /*! @param[out] result determined size @param[in,out] is_ndarray for input, `true` means already inside an ndarray vector or ndarray dimension is not allowed; `false` means ndarray is allowed; for output, `true` means an ndarray is found; is_ndarray can only return `true` when its initial value is `false` @param[in] prefix type marker if already read, otherwise set to 0 @return whether size determination completed */ bool get_ubjson_size_value(std::size_t& result, bool& is_ndarray, char_int_type prefix = 0) { if (prefix == 0) { prefix = get_ignore_noop(); } switch (prefix) { case 'U': { std::uint8_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } result = static_cast(number); return true; } case 'i': { std::int8_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } if (number < 0) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr)); } result = static_cast(number); // NOLINT(bugprone-signed-char-misuse,cert-str34-c): number is not a char return true; } case 'I': { std::int16_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } if (number < 0) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr)); } result = static_cast(number); return true; } case 'l': { std::int32_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } if (number < 0) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr)); } result = static_cast(number); return true; } case 'L': { std::int64_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } if (number < 0) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr)); } if (!value_in_range_of(number)) { return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, exception_message(input_format, "integer value overflow", "size"), nullptr)); } result = static_cast(number); return true; } case 'u': { if (input_format != input_format_t::bjdata) { break; } std::uint16_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } result = static_cast(number); return true; } case 'm': { if (input_format != input_format_t::bjdata) { break; } std::uint32_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } result = conditional_static_cast(number); return true; } case 'M': { if (input_format != input_format_t::bjdata) { break; } std::uint64_t number{}; if (JSON_HEDLEY_UNLIKELY(!get_number(input_format, number))) { return false; } if (!value_in_range_of(number)) { return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, exception_message(input_format, "integer value overflow", "size"), nullptr)); } result = detail::conditional_static_cast(number); return true; } case '[': { if (input_format != input_format_t::bjdata) { break; } if (is_ndarray) // ndarray dimensional vector can only contain integers, and can not embed another array { return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read, exception_message(input_format, "ndarray dimensional vector is not allowed", "size"), nullptr)); } std::vector dim; if (JSON_HEDLEY_UNLIKELY(!get_ubjson_ndarray_size(dim))) { return false; } if (dim.size() == 1 || (dim.size() == 2 && dim.at(0) == 1)) // return normal array size if 1D row vector { result = dim.at(dim.size() - 1); return true; } if (!dim.empty()) // if ndarray, convert to an object in JData annotated array format { for (auto i : dim) // test if any dimension in an ndarray is 0, if so, return a 1D empty container { if ( i == 0 ) { result = 0; return true; } } string_t key = "_ArraySize_"; if (JSON_HEDLEY_UNLIKELY(!sax->start_object(3) || !sax->key(key) || !sax->start_array(dim.size()))) { return false; } result = 1; for (auto i : dim) { result *= i; if (result == 0 || result == npos) // because dim elements shall not have zeros, result = 0 means overflow happened; it also can't be npos as it is used to initialize size in get_ubjson_size_type() { return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, exception_message(input_format, "excessive ndarray size caused overflow", "size"), nullptr)); } if (JSON_HEDLEY_UNLIKELY(!sax->number_unsigned(static_cast(i)))) { return false; } } is_ndarray = true; return sax->end_array(); } result = 0; return true; } default: break; } auto last_token = get_token_string(); std::string message; if (input_format != input_format_t::bjdata) { message = "expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token; } else { message = "expected length type specification (U, i, u, I, m, l, M, L) after '#'; last byte: 0x" + last_token; } return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format, message, "size"), nullptr)); } /*! @brief determine the type and size for a container In the optimized UBJSON format, a type and a size can be provided to allow for a more compact representation. @param[out] result pair of the size and the type @param[in] inside_ndarray whether the parser is parsing an ND array dimensional vector @return whether pair creation completed */ bool get_ubjson_size_type(std::pair& result, bool inside_ndarray = false) { result.first = npos; // size result.second = 0; // type bool is_ndarray = false; get_ignore_noop(); if (current == '$') { result.second = get(); // must not ignore 'N', because 'N' maybe the type if (input_format == input_format_t::bjdata && JSON_HEDLEY_UNLIKELY(std::binary_search(bjd_optimized_type_markers.begin(), bjd_optimized_type_markers.end(), result.second))) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format, concat("marker 0x", last_token, " is not a permitted optimized array type"), "type"), nullptr)); } if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "type"))) { return false; } get_ignore_noop(); if (JSON_HEDLEY_UNLIKELY(current != '#')) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "value"))) { return false; } auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format, concat("expected '#' after type information; last byte: 0x", last_token), "size"), nullptr)); } const bool is_error = get_ubjson_size_value(result.first, is_ndarray); if (input_format == input_format_t::bjdata && is_ndarray) { if (inside_ndarray) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(112, chars_read, exception_message(input_format, "ndarray can not be recursive", "size"), nullptr)); } result.second |= (1 << 8); // use bit 8 to indicate ndarray, all UBJSON and BJData markers should be ASCII letters } return is_error; } if (current == '#') { const bool is_error = get_ubjson_size_value(result.first, is_ndarray); if (input_format == input_format_t::bjdata && is_ndarray) { return sax->parse_error(chars_read, get_token_string(), parse_error::create(112, chars_read, exception_message(input_format, "ndarray requires both type and size", "size"), nullptr)); } return is_error; } return true; } /*! @param prefix the previously read or set type prefix @return whether value creation completed */ bool get_ubjson_value(const char_int_type prefix) { switch (prefix) { case char_traits::eof(): // EOF return unexpect_eof(input_format, "value"); case 'T': // true return sax->boolean(true); case 'F': // false return sax->boolean(false); case 'Z': // null return sax->null(); case 'B': // byte { if (input_format != input_format_t::bjdata) { break; } std::uint8_t number{}; return get_number(input_format, number) && sax->number_unsigned(number); } case 'U': { std::uint8_t number{}; return get_number(input_format, number) && sax->number_unsigned(number); } case 'i': { std::int8_t number{}; return get_number(input_format, number) && sax->number_integer(number); } case 'I': { std::int16_t number{}; return get_number(input_format, number) && sax->number_integer(number); } case 'l': { std::int32_t number{}; return get_number(input_format, number) && sax->number_integer(number); } case 'L': { std::int64_t number{}; return get_number(input_format, number) && sax->number_integer(number); } case 'u': { if (input_format != input_format_t::bjdata) { break; } std::uint16_t number{}; return get_number(input_format, number) && sax->number_unsigned(number); } case 'm': { if (input_format != input_format_t::bjdata) { break; } std::uint32_t number{}; return get_number(input_format, number) && sax->number_unsigned(number); } case 'M': { if (input_format != input_format_t::bjdata) { break; } std::uint64_t number{}; return get_number(input_format, number) && sax->number_unsigned(number); } case 'h': { if (input_format != input_format_t::bjdata) { break; } const auto byte1_raw = get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "number"))) { return false; } const auto byte2_raw = get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "number"))) { return false; } const auto byte1 = static_cast(byte1_raw); const auto byte2 = static_cast(byte2_raw); // code from RFC 7049, Appendix D, Figure 3: // As half-precision floating-point numbers were only added // to IEEE 754 in 2008, today's programming platforms often // still only have limited support for them. It is very // easy to include at least decoding support for them even // without such support. An example of a small decoder for // half-precision floating-point numbers in the C language // is shown in Fig. 3. const auto half = static_cast((byte2 << 8u) + byte1); const double val = [&half] { const int exp = (half >> 10u) & 0x1Fu; const unsigned int mant = half & 0x3FFu; JSON_ASSERT(0 <= exp&& exp <= 32); JSON_ASSERT(mant <= 1024); switch (exp) { case 0: return std::ldexp(mant, -24); case 31: return (mant == 0) ? std::numeric_limits::infinity() : std::numeric_limits::quiet_NaN(); default: return std::ldexp(mant + 1024, exp - 25); } }(); return sax->number_float((half & 0x8000u) != 0 ? static_cast(-val) : static_cast(val), ""); } case 'd': { float number{}; return get_number(input_format, number) && sax->number_float(static_cast(number), ""); } case 'D': { double number{}; return get_number(input_format, number) && sax->number_float(static_cast(number), ""); } case 'H': { return get_ubjson_high_precision_number(); } case 'C': // char { get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "char"))) { return false; } if (JSON_HEDLEY_UNLIKELY(current > 127)) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format, concat("byte after 'C' must be in range 0x00..0x7F; last byte: 0x", last_token), "char"), nullptr)); } string_t s(1, static_cast(current)); return sax->string(s); } case 'S': // string { string_t s; return get_ubjson_string(s) && sax->string(s); } case '[': // array return get_ubjson_array(); case '{': // object return get_ubjson_object(); default: // anything else break; } auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format, "invalid byte: 0x" + last_token, "value"), nullptr)); } /*! @return whether array creation completed */ bool get_ubjson_array() { std::pair size_and_type; if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type))) { return false; } // if bit-8 of size_and_type.second is set to 1, encode bjdata ndarray as an object in JData annotated array format (https://github.com/NeuroJSON/jdata): // {"_ArrayType_" : "typeid", "_ArraySize_" : [n1, n2, ...], "_ArrayData_" : [v1, v2, ...]} if (input_format == input_format_t::bjdata && size_and_type.first != npos && (size_and_type.second & (1 << 8)) != 0) { size_and_type.second &= ~(static_cast(1) << 8); // use bit 8 to indicate ndarray, here we remove the bit to restore the type marker auto it = std::lower_bound(bjd_types_map.begin(), bjd_types_map.end(), size_and_type.second, [](const bjd_type & p, char_int_type t) { return p.first < t; }); string_t key = "_ArrayType_"; if (JSON_HEDLEY_UNLIKELY(it == bjd_types_map.end() || it->first != size_and_type.second)) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format, "invalid byte: 0x" + last_token, "type"), nullptr)); } string_t type = it->second; // sax->string() takes a reference if (JSON_HEDLEY_UNLIKELY(!sax->key(key) || !sax->string(type))) { return false; } if (size_and_type.second == 'C' || size_and_type.second == 'B') { size_and_type.second = 'U'; } key = "_ArrayData_"; if (JSON_HEDLEY_UNLIKELY(!sax->key(key) || !sax->start_array(size_and_type.first) )) { return false; } for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second))) { return false; } } return (sax->end_array() && sax->end_object()); } // If BJData type marker is 'B' decode as binary if (input_format == input_format_t::bjdata && size_and_type.first != npos && size_and_type.second == 'B') { binary_t result; return get_binary(input_format, size_and_type.first, result) && sax->binary(result); } if (size_and_type.first != npos) { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(size_and_type.first))) { return false; } if (size_and_type.second != 0) { if (size_and_type.second != 'N') { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second))) { return false; } } } } else { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal())) { return false; } } } } else { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(detail::unknown_size()))) { return false; } while (current != ']') { if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal(false))) { return false; } get_ignore_noop(); } } return sax->end_array(); } /*! @return whether object creation completed */ bool get_ubjson_object() { std::pair size_and_type; if (JSON_HEDLEY_UNLIKELY(!get_ubjson_size_type(size_and_type))) { return false; } // do not accept ND-array size in objects in BJData if (input_format == input_format_t::bjdata && size_and_type.first != npos && (size_and_type.second & (1 << 8)) != 0) { auto last_token = get_token_string(); return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format, "BJData object does not support ND-array size in optimized format", "object"), nullptr)); } string_t key; if (size_and_type.first != npos) { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(size_and_type.first))) { return false; } if (size_and_type.second != 0) { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!get_ubjson_value(size_and_type.second))) { return false; } key.clear(); } } else { for (std::size_t i = 0; i < size_and_type.first; ++i) { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal())) { return false; } key.clear(); } } } else { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(detail::unknown_size()))) { return false; } while (current != '}') { if (JSON_HEDLEY_UNLIKELY(!get_ubjson_string(key, false) || !sax->key(key))) { return false; } if (JSON_HEDLEY_UNLIKELY(!parse_ubjson_internal())) { return false; } get_ignore_noop(); key.clear(); } } return sax->end_object(); } // Note, no reader for UBJSON binary types is implemented because they do // not exist bool get_ubjson_high_precision_number() { // get size of following number string std::size_t size{}; bool no_ndarray = true; auto res = get_ubjson_size_value(size, no_ndarray); if (JSON_HEDLEY_UNLIKELY(!res)) { return res; } // get number string std::vector number_vector; for (std::size_t i = 0; i < size; ++i) { get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format, "number"))) { return false; } number_vector.push_back(static_cast(current)); } // parse number string using ia_type = decltype(detail::input_adapter(number_vector)); auto number_lexer = detail::lexer(detail::input_adapter(number_vector), false); const auto result_number = number_lexer.scan(); const auto number_string = number_lexer.get_token_string(); const auto result_remainder = number_lexer.scan(); using token_type = typename detail::lexer_base::token_type; if (JSON_HEDLEY_UNLIKELY(result_remainder != token_type::end_of_input)) { return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format, concat("invalid number text: ", number_lexer.get_token_string()), "high-precision number"), nullptr)); } switch (result_number) { case token_type::value_integer: return sax->number_integer(number_lexer.get_number_integer()); case token_type::value_unsigned: return sax->number_unsigned(number_lexer.get_number_unsigned()); case token_type::value_float: return sax->number_float(number_lexer.get_number_float(), std::move(number_string)); case token_type::uninitialized: case token_type::literal_true: case token_type::literal_false: case token_type::literal_null: case token_type::value_string: case token_type::begin_array: case token_type::begin_object: case token_type::end_array: case token_type::end_object: case token_type::name_separator: case token_type::value_separator: case token_type::parse_error: case token_type::end_of_input: case token_type::literal_or_value: default: return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format, concat("invalid number text: ", number_lexer.get_token_string()), "high-precision number"), nullptr)); } } /////////////////////// // Utility functions // /////////////////////// /*! @brief get next character from the input This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a -'ve valued `char_traits::eof()` in that case. @return character read from the input */ char_int_type get() { ++chars_read; return current = ia.get_character(); } /*! @brief get_to read into a primitive type This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns false instead @return bool, whether the read was successful */ template bool get_to(T& dest, const input_format_t format, const char* context) { auto new_chars_read = ia.get_elements(&dest); chars_read += new_chars_read; if (JSON_HEDLEY_UNLIKELY(new_chars_read < sizeof(T))) { // in case of failure, advance position by 1 to report failing location ++chars_read; sax->parse_error(chars_read, "", parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context), nullptr)); return false; } return true; } /*! @return character read from the input after ignoring all 'N' entries */ char_int_type get_ignore_noop() { do { get(); } while (current == 'N'); return current; } template static void byte_swap(NumberType& number) { constexpr std::size_t sz = sizeof(number); #ifdef __cpp_lib_byteswap if constexpr (sz == 1) { return; } if constexpr(std::is_integral_v) { number = std::byteswap(number); return; } #endif auto* ptr = reinterpret_cast(&number); for (std::size_t i = 0; i < sz / 2; ++i) { std::swap(ptr[i], ptr[sz - i - 1]); } } /* @brief read a number from the input @tparam NumberType the type of the number @param[in] format the current format (for diagnostics) @param[out] result number of type @a NumberType @return whether conversion completed @note This function needs to respect the system's endianness, because bytes in CBOR, MessagePack, and UBJSON are stored in network order (big endian) and therefore need reordering on little endian systems. On the other hand, BSON and BJData use little endian and should reorder on big endian systems. */ template bool get_number(const input_format_t format, NumberType& result) { // read in the original format if (JSON_HEDLEY_UNLIKELY(!get_to(result, format, "number"))) { return false; } if (is_little_endian != (InputIsLittleEndian || format == input_format_t::bjdata)) { byte_swap(result); } return true; } /*! @brief create a string by reading characters from the input @tparam NumberType the type of the number @param[in] format the current format (for diagnostics) @param[in] len number of characters to read @param[out] result string created by reading @a len bytes @return whether string creation completed @note We can not reserve @a len bytes for the result, because @a len may be too large. Usually, @ref unexpect_eof() detects the end of the input before we run out of string memory. */ template bool get_string(const input_format_t format, const NumberType len, string_t& result) { bool success = true; for (NumberType i = 0; i < len; i++) { get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, "string"))) { success = false; break; } result.push_back(static_cast(current)); } return success; } /*! @brief create a byte array by reading bytes from the input @tparam NumberType the type of the number @param[in] format the current format (for diagnostics) @param[in] len number of bytes to read @param[out] result byte array created by reading @a len bytes @return whether byte array creation completed @note We can not reserve @a len bytes for the result, because @a len may be too large. Usually, @ref unexpect_eof() detects the end of the input before we run out of memory. */ template bool get_binary(const input_format_t format, const NumberType len, binary_t& result) { bool success = true; for (NumberType i = 0; i < len; i++) { get(); if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(format, "binary"))) { success = false; break; } result.push_back(static_cast(current)); } return success; } /*! @param[in] format the current format (for diagnostics) @param[in] context further context information (for diagnostics) @return whether the last read character is not EOF */ JSON_HEDLEY_NON_NULL(3) bool unexpect_eof(const input_format_t format, const char* context) const { if (JSON_HEDLEY_UNLIKELY(current == char_traits::eof())) { return sax->parse_error(chars_read, "", parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context), nullptr)); } return true; } /*! @return a string representation of the last read byte */ std::string get_token_string() const { std::array cr{{}}; static_cast((std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(current))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) return std::string{cr.data()}; } /*! @param[in] format the current format @param[in] detail a detailed error message @param[in] context further context information @return a message string to use in the parse_error exceptions */ std::string exception_message(const input_format_t format, const std::string& detail, const std::string& context) const { std::string error_msg = "syntax error while parsing "; switch (format) { case input_format_t::cbor: error_msg += "CBOR"; break; case input_format_t::msgpack: error_msg += "MessagePack"; break; case input_format_t::ubjson: error_msg += "UBJSON"; break; case input_format_t::bson: error_msg += "BSON"; break; case input_format_t::bjdata: error_msg += "BJData"; break; case input_format_t::json: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE } return concat(error_msg, ' ', context, ": ", detail); } private: static JSON_INLINE_VARIABLE constexpr std::size_t npos = detail::unknown_size(); /// input adapter InputAdapterType ia; /// the current character char_int_type current = char_traits::eof(); /// the number of characters read std::size_t chars_read = 0; /// whether we can assume little endianness const bool is_little_endian = little_endianness(); /// input format const input_format_t input_format = input_format_t::json; /// the SAX parser json_sax_t* sax = nullptr; // excluded markers in bjdata optimized type #define JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ \ make_array('F', 'H', 'N', 'S', 'T', 'Z', '[', '{') #define JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_ \ make_array( \ bjd_type{'B', "byte"}, \ bjd_type{'C', "char"}, \ bjd_type{'D', "double"}, \ bjd_type{'I', "int16"}, \ bjd_type{'L', "int64"}, \ bjd_type{'M', "uint64"}, \ bjd_type{'U', "uint8"}, \ bjd_type{'d', "single"}, \ bjd_type{'i', "int8"}, \ bjd_type{'l', "int32"}, \ bjd_type{'m', "uint32"}, \ bjd_type{'u', "uint16"}) JSON_PRIVATE_UNLESS_TESTED: // lookup tables // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes) const decltype(JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_) bjd_optimized_type_markers = JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_; using bjd_type = std::pair; // NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes) const decltype(JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_) bjd_types_map = JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_; #undef JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ #undef JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_ }; #ifndef JSON_HAS_CPP_17 template constexpr std::size_t binary_reader::npos; #endif } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/input_adapters.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // array #include // size_t #include // strlen #include // begin, end, iterator_traits, random_access_iterator_tag, distance, next #include // shared_ptr, make_shared, addressof #include // accumulate #include // string, char_traits #include // enable_if, is_base_of, is_pointer, is_integral, remove_pointer #include // pair, declval #ifndef JSON_NO_IO #include // FILE * #include // istream #endif // JSON_NO_IO #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /// the supported input formats enum class input_format_t { json, cbor, msgpack, ubjson, bson, bjdata }; //////////////////// // input adapters // //////////////////// #ifndef JSON_NO_IO /*! Input adapter for stdio file access. This adapter read only 1 byte and do not use any buffer. This adapter is a very low level adapter. */ class file_input_adapter { public: using char_type = char; JSON_HEDLEY_NON_NULL(2) explicit file_input_adapter(std::FILE* f) noexcept : m_file(f) { JSON_ASSERT(m_file != nullptr); } // make class move-only file_input_adapter(const file_input_adapter&) = delete; file_input_adapter(file_input_adapter&&) noexcept = default; file_input_adapter& operator=(const file_input_adapter&) = delete; file_input_adapter& operator=(file_input_adapter&&) = delete; ~file_input_adapter() = default; std::char_traits::int_type get_character() noexcept { return std::fgetc(m_file); } // returns the number of characters successfully read template std::size_t get_elements(T* dest, std::size_t count = 1) { return fread(dest, 1, sizeof(T) * count, m_file); } private: /// the file pointer to read from std::FILE* m_file; }; /*! Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at beginning of input. Does not support changing the underlying std::streambuf in mid-input. Maintains underlying std::istream and std::streambuf to support subsequent use of standard std::istream operations to process any input characters following those used in parsing the JSON input. Clears the std::istream flags; any input errors (e.g., EOF) will be detected by the first subsequent call for input from the std::istream. */ class input_stream_adapter { public: using char_type = char; ~input_stream_adapter() { // clear stream flags; we use underlying streambuf I/O, do not // maintain ifstream flags, except eof if (is != nullptr) { is->clear(is->rdstate() & std::ios::eofbit); } } explicit input_stream_adapter(std::istream& i) : is(&i), sb(i.rdbuf()) {} // delete because of pointer members input_stream_adapter(const input_stream_adapter&) = delete; input_stream_adapter& operator=(input_stream_adapter&) = delete; input_stream_adapter& operator=(input_stream_adapter&&) = delete; input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs.is), sb(rhs.sb) { rhs.is = nullptr; rhs.sb = nullptr; } // std::istream/std::streambuf use std::char_traits::to_int_type, to // ensure that std::char_traits::eof() and the character 0xFF do not // end up as the same value, e.g. 0xFFFFFFFF. std::char_traits::int_type get_character() { auto res = sb->sbumpc(); // set eof manually, as we don't use the istream interface. if (JSON_HEDLEY_UNLIKELY(res == std::char_traits::eof())) { is->clear(is->rdstate() | std::ios::eofbit); } return res; } template std::size_t get_elements(T* dest, std::size_t count = 1) { auto res = static_cast(sb->sgetn(reinterpret_cast(dest), static_cast(count * sizeof(T)))); if (JSON_HEDLEY_UNLIKELY(res < count * sizeof(T))) { is->clear(is->rdstate() | std::ios::eofbit); } return res; } private: /// the associated input stream std::istream* is = nullptr; std::streambuf* sb = nullptr; }; #endif // JSON_NO_IO // General-purpose iterator-based adapter. It might not be as fast as // theoretically possible for some containers, but it is extremely versatile. template class iterator_input_adapter { public: using char_type = typename std::iterator_traits::value_type; iterator_input_adapter(IteratorType first, IteratorType last) : current(std::move(first)), end(std::move(last)) {} typename char_traits::int_type get_character() { if (JSON_HEDLEY_LIKELY(current != end)) { auto result = char_traits::to_int_type(*current); std::advance(current, 1); return result; } return char_traits::eof(); } // for general iterators, we cannot really do something better than falling back to processing the range one-by-one template std::size_t get_elements(T* dest, std::size_t count = 1) { auto* ptr = reinterpret_cast(dest); for (std::size_t read_index = 0; read_index < count * sizeof(T); ++read_index) { if (JSON_HEDLEY_LIKELY(current != end)) { ptr[read_index] = static_cast(*current); std::advance(current, 1); } else { return read_index; } } return count * sizeof(T); } private: IteratorType current; IteratorType end; template friend struct wide_string_input_helper; bool empty() const { return current == end; } }; template struct wide_string_input_helper; template struct wide_string_input_helper { // UTF-32 static void fill_buffer(BaseInputAdapter& input, std::array::int_type, 4>& utf8_bytes, size_t& utf8_bytes_index, size_t& utf8_bytes_filled) { utf8_bytes_index = 0; if (JSON_HEDLEY_UNLIKELY(input.empty())) { utf8_bytes[0] = std::char_traits::eof(); utf8_bytes_filled = 1; } else { // get the current character const auto wc = input.get_character(); // UTF-32 to UTF-8 encoding if (wc < 0x80) { utf8_bytes[0] = static_cast::int_type>(wc); utf8_bytes_filled = 1; } else if (wc <= 0x7FF) { utf8_bytes[0] = static_cast::int_type>(0xC0u | ((static_cast(wc) >> 6u) & 0x1Fu)); utf8_bytes[1] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 2; } else if (wc <= 0xFFFF) { utf8_bytes[0] = static_cast::int_type>(0xE0u | ((static_cast(wc) >> 12u) & 0x0Fu)); utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); utf8_bytes[2] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 3; } else if (wc <= 0x10FFFF) { utf8_bytes[0] = static_cast::int_type>(0xF0u | ((static_cast(wc) >> 18u) & 0x07u)); utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 12u) & 0x3Fu)); utf8_bytes[2] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); utf8_bytes[3] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 4; } else { // unknown character utf8_bytes[0] = static_cast::int_type>(wc); utf8_bytes_filled = 1; } } } }; template struct wide_string_input_helper { // UTF-16 static void fill_buffer(BaseInputAdapter& input, std::array::int_type, 4>& utf8_bytes, size_t& utf8_bytes_index, size_t& utf8_bytes_filled) { utf8_bytes_index = 0; if (JSON_HEDLEY_UNLIKELY(input.empty())) { utf8_bytes[0] = std::char_traits::eof(); utf8_bytes_filled = 1; } else { // get the current character const auto wc = input.get_character(); // UTF-16 to UTF-8 encoding if (wc < 0x80) { utf8_bytes[0] = static_cast::int_type>(wc); utf8_bytes_filled = 1; } else if (wc <= 0x7FF) { utf8_bytes[0] = static_cast::int_type>(0xC0u | ((static_cast(wc) >> 6u))); utf8_bytes[1] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 2; } else if (0xD800 > wc || wc >= 0xE000) { utf8_bytes[0] = static_cast::int_type>(0xE0u | ((static_cast(wc) >> 12u))); utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); utf8_bytes[2] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 3; } else { if (JSON_HEDLEY_UNLIKELY(!input.empty())) { const auto wc2 = static_cast(input.get_character()); const auto charcode = 0x10000u + (((static_cast(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu)); utf8_bytes[0] = static_cast::int_type>(0xF0u | (charcode >> 18u)); utf8_bytes[1] = static_cast::int_type>(0x80u | ((charcode >> 12u) & 0x3Fu)); utf8_bytes[2] = static_cast::int_type>(0x80u | ((charcode >> 6u) & 0x3Fu)); utf8_bytes[3] = static_cast::int_type>(0x80u | (charcode & 0x3Fu)); utf8_bytes_filled = 4; } else { utf8_bytes[0] = static_cast::int_type>(wc); utf8_bytes_filled = 1; } } } } }; // Wraps another input adapter to convert wide character types into individual bytes. template class wide_string_input_adapter { public: using char_type = char; wide_string_input_adapter(BaseInputAdapter base) : base_adapter(base) {} typename std::char_traits::int_type get_character() noexcept { // check if buffer needs to be filled if (utf8_bytes_index == utf8_bytes_filled) { fill_buffer(); JSON_ASSERT(utf8_bytes_filled > 0); JSON_ASSERT(utf8_bytes_index == 0); } // use buffer JSON_ASSERT(utf8_bytes_filled > 0); JSON_ASSERT(utf8_bytes_index < utf8_bytes_filled); return utf8_bytes[utf8_bytes_index++]; } // parsing binary with wchar doesn't make sense, but since the parsing mode can be runtime, we need something here template std::size_t get_elements(T* /*dest*/, std::size_t /*count*/ = 1) { JSON_THROW(parse_error::create(112, 1, "wide string type cannot be interpreted as binary data", nullptr)); } private: BaseInputAdapter base_adapter; template void fill_buffer() { wide_string_input_helper::fill_buffer(base_adapter, utf8_bytes, utf8_bytes_index, utf8_bytes_filled); } /// a buffer for UTF-8 bytes std::array::int_type, 4> utf8_bytes = {{0, 0, 0, 0}}; /// index to the utf8_codes array for the next valid byte std::size_t utf8_bytes_index = 0; /// number of valid bytes in the utf8_codes array std::size_t utf8_bytes_filled = 0; }; template struct iterator_input_adapter_factory { using iterator_type = IteratorType; using char_type = typename std::iterator_traits::value_type; using adapter_type = iterator_input_adapter; static adapter_type create(IteratorType first, IteratorType last) { return adapter_type(std::move(first), std::move(last)); } }; template struct is_iterator_of_multibyte { using value_type = typename std::iterator_traits::value_type; enum { value = sizeof(value_type) > 1 }; }; template struct iterator_input_adapter_factory::value>> { using iterator_type = IteratorType; using char_type = typename std::iterator_traits::value_type; using base_adapter_type = iterator_input_adapter; using adapter_type = wide_string_input_adapter; static adapter_type create(IteratorType first, IteratorType last) { return adapter_type(base_adapter_type(std::move(first), std::move(last))); } }; // General purpose iterator-based input template typename iterator_input_adapter_factory::adapter_type input_adapter(IteratorType first, IteratorType last) { using factory_type = iterator_input_adapter_factory; return factory_type::create(first, last); } // Convenience shorthand from container to iterator // Enables ADL on begin(container) and end(container) // Encloses the using declarations in namespace for not to leak them to outside scope namespace container_input_adapter_factory_impl { using std::begin; using std::end; template struct container_input_adapter_factory {}; template struct container_input_adapter_factory< ContainerType, void_t()), end(std::declval()))>> { using adapter_type = decltype(input_adapter(begin(std::declval()), end(std::declval()))); static adapter_type create(const ContainerType& container) { return input_adapter(begin(container), end(container)); } }; } // namespace container_input_adapter_factory_impl template typename container_input_adapter_factory_impl::container_input_adapter_factory::adapter_type input_adapter(const ContainerType& container) { return container_input_adapter_factory_impl::container_input_adapter_factory::create(container); } // specialization for std::string using string_input_adapter_type = decltype(input_adapter(std::declval())); #ifndef JSON_NO_IO // Special cases with fast paths inline file_input_adapter input_adapter(std::FILE* file) { if (file == nullptr) { JSON_THROW(parse_error::create(101, 0, "attempting to parse an empty input; check that your input string or stream contains the expected JSON", nullptr)); } return file_input_adapter(file); } inline input_stream_adapter input_adapter(std::istream& stream) { return input_stream_adapter(stream); } inline input_stream_adapter input_adapter(std::istream&& stream) { return input_stream_adapter(stream); } #endif // JSON_NO_IO using contiguous_bytes_input_adapter = decltype(input_adapter(std::declval(), std::declval())); // Null-delimited strings, and the like. template < typename CharT, typename std::enable_if < std::is_pointer::value&& !std::is_array::value&& std::is_integral::type>::value&& sizeof(typename std::remove_pointer::type) == 1, int >::type = 0 > contiguous_bytes_input_adapter input_adapter(CharT b) { if (b == nullptr) { JSON_THROW(parse_error::create(101, 0, "attempting to parse an empty input; check that your input string or stream contains the expected JSON", nullptr)); } auto length = std::strlen(reinterpret_cast(b)); const auto* ptr = reinterpret_cast(b); return input_adapter(ptr, ptr + length); // cppcheck-suppress[nullPointerArithmeticRedundantCheck] } template auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, array + N)) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { return input_adapter(array, array + N); } // This class only handles inputs of input_buffer_adapter type. // It's required so that expressions like {ptr, len} can be implicitly cast // to the correct adapter. class span_input_adapter { public: template < typename CharT, typename std::enable_if < std::is_pointer::value&& std::is_integral::type>::value&& sizeof(typename std::remove_pointer::type) == 1, int >::type = 0 > span_input_adapter(CharT b, std::size_t l) : ia(reinterpret_cast(b), reinterpret_cast(b) + l) {} template::iterator_category, std::random_access_iterator_tag>::value, int>::type = 0> span_input_adapter(IteratorType first, IteratorType last) : ia(input_adapter(first, last)) {} contiguous_bytes_input_adapter&& get() { return std::move(ia); // NOLINT(hicpp-move-const-arg,performance-move-const-arg) } private: contiguous_bytes_input_adapter ia; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/json_sax.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #include // string #include // enable_if_t #include // move #include // vector #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief SAX interface This class describes the SAX interface used by @ref nlohmann::json::sax_parse. Each function is called in different situations while the input is parsed. The boolean return value informs the parser whether to continue processing the input. */ template struct json_sax { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; /*! @brief a null value was read @return whether parsing should proceed */ virtual bool null() = 0; /*! @brief a boolean value was read @param[in] val boolean value @return whether parsing should proceed */ virtual bool boolean(bool val) = 0; /*! @brief an integer number was read @param[in] val integer value @return whether parsing should proceed */ virtual bool number_integer(number_integer_t val) = 0; /*! @brief an unsigned integer number was read @param[in] val unsigned integer value @return whether parsing should proceed */ virtual bool number_unsigned(number_unsigned_t val) = 0; /*! @brief a floating-point number was read @param[in] val floating-point value @param[in] s raw token value @return whether parsing should proceed */ virtual bool number_float(number_float_t val, const string_t& s) = 0; /*! @brief a string value was read @param[in] val string value @return whether parsing should proceed @note It is safe to move the passed string value. */ virtual bool string(string_t& val) = 0; /*! @brief a binary value was read @param[in] val binary value @return whether parsing should proceed @note It is safe to move the passed binary value. */ virtual bool binary(binary_t& val) = 0; /*! @brief the beginning of an object was read @param[in] elements number of object elements or -1 if unknown @return whether parsing should proceed @note binary formats may report the number of elements */ virtual bool start_object(std::size_t elements) = 0; /*! @brief an object key was read @param[in] val object key @return whether parsing should proceed @note It is safe to move the passed string. */ virtual bool key(string_t& val) = 0; /*! @brief the end of an object was read @return whether parsing should proceed */ virtual bool end_object() = 0; /*! @brief the beginning of an array was read @param[in] elements number of array elements or -1 if unknown @return whether parsing should proceed @note binary formats may report the number of elements */ virtual bool start_array(std::size_t elements) = 0; /*! @brief the end of an array was read @return whether parsing should proceed */ virtual bool end_array() = 0; /*! @brief a parse error occurred @param[in] position the position in the input where the error occurs @param[in] last_token the last read token @param[in] ex an exception object describing the error @return whether parsing should proceed (must return false) */ virtual bool parse_error(std::size_t position, const std::string& last_token, const detail::exception& ex) = 0; json_sax() = default; json_sax(const json_sax&) = default; json_sax(json_sax&&) noexcept = default; json_sax& operator=(const json_sax&) = default; json_sax& operator=(json_sax&&) noexcept = default; virtual ~json_sax() = default; }; namespace detail { constexpr std::size_t unknown_size() { return (std::numeric_limits::max)(); } /*! @brief SAX implementation to create a JSON value from SAX events This class implements the @ref json_sax interface and processes the SAX events to create a JSON value which makes it basically a DOM parser. The structure or hierarchy of the JSON value is managed by the stack `ref_stack` which contains a pointer to the respective array or object for each recursion depth. After successful parsing, the value that is passed by reference to the constructor contains the parsed value. @tparam BasicJsonType the JSON type */ template class json_sax_dom_parser { public: using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; using lexer_t = lexer; /*! @param[in,out] r reference to a JSON value that is manipulated while parsing @param[in] allow_exceptions_ whether parse errors yield exceptions */ explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true, lexer_t* lexer_ = nullptr) : root(r), allow_exceptions(allow_exceptions_), m_lexer_ref(lexer_) {} // make class move-only json_sax_dom_parser(const json_sax_dom_parser&) = delete; json_sax_dom_parser(json_sax_dom_parser&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete; json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) ~json_sax_dom_parser() = default; bool null() { handle_value(nullptr); return true; } bool boolean(bool val) { handle_value(val); return true; } bool number_integer(number_integer_t val) { handle_value(val); return true; } bool number_unsigned(number_unsigned_t val) { handle_value(val); return true; } bool number_float(number_float_t val, const string_t& /*unused*/) { handle_value(val); return true; } bool string(string_t& val) { handle_value(val); return true; } bool binary(binary_t& val) { handle_value(std::move(val)); return true; } bool start_object(std::size_t len) { ref_stack.push_back(handle_value(BasicJsonType::value_t::object)); #if JSON_DIAGNOSTIC_POSITIONS // Manually set the start position of the object here. // Ensure this is after the call to handle_value to ensure correct start position. if (m_lexer_ref) { // Lexer has read the first character of the object, so // subtract 1 from the position to get the correct start position. ref_stack.back()->start_position = m_lexer_ref->get_position() - 1; } #endif if (JSON_HEDLEY_UNLIKELY(len != detail::unknown_size() && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, concat("excessive object size: ", std::to_string(len)), ref_stack.back())); } return true; } bool key(string_t& val) { JSON_ASSERT(!ref_stack.empty()); JSON_ASSERT(ref_stack.back()->is_object()); // add null at given key and store the reference for later object_element = &(ref_stack.back()->m_data.m_value.object->operator[](val)); return true; } bool end_object() { JSON_ASSERT(!ref_stack.empty()); JSON_ASSERT(ref_stack.back()->is_object()); #if JSON_DIAGNOSTIC_POSITIONS if (m_lexer_ref) { // Lexer's position is past the closing brace, so set that as the end position. ref_stack.back()->end_position = m_lexer_ref->get_position(); } #endif ref_stack.back()->set_parents(); ref_stack.pop_back(); return true; } bool start_array(std::size_t len) { ref_stack.push_back(handle_value(BasicJsonType::value_t::array)); #if JSON_DIAGNOSTIC_POSITIONS // Manually set the start position of the array here. // Ensure this is after the call to handle_value to ensure correct start position. if (m_lexer_ref) { ref_stack.back()->start_position = m_lexer_ref->get_position() - 1; } #endif if (JSON_HEDLEY_UNLIKELY(len != detail::unknown_size() && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, concat("excessive array size: ", std::to_string(len)), ref_stack.back())); } return true; } bool end_array() { JSON_ASSERT(!ref_stack.empty()); JSON_ASSERT(ref_stack.back()->is_array()); #if JSON_DIAGNOSTIC_POSITIONS if (m_lexer_ref) { // Lexer's position is past the closing bracket, so set that as the end position. ref_stack.back()->end_position = m_lexer_ref->get_position(); } #endif ref_stack.back()->set_parents(); ref_stack.pop_back(); return true; } template bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const Exception& ex) { errored = true; static_cast(ex); if (allow_exceptions) { JSON_THROW(ex); } return false; } constexpr bool is_errored() const { return errored; } private: #if JSON_DIAGNOSTIC_POSITIONS void handle_diagnostic_positions_for_json_value(BasicJsonType& v) { if (m_lexer_ref) { // Lexer has read past the current field value, so set the end position to the current position. // The start position will be set below based on the length of the string representation // of the value. v.end_position = m_lexer_ref->get_position(); switch (v.type()) { case value_t::boolean: { // 4 and 5 are the string length of "true" and "false" v.start_position = v.end_position - (v.m_data.m_value.boolean ? 4 : 5); break; } case value_t::null: { // 4 is the string length of "null" v.start_position = v.end_position - 4; break; } case value_t::string: { // include the length of the quotes, which is 2 v.start_position = v.end_position - v.m_data.m_value.string->size() - 2; break; } // As we handle the start and end positions for values created during parsing, // we do not expect the following value type to be called. Regardless, set the positions // in case this is created manually or through a different constructor. Exclude from lcov // since the exact condition of this switch is esoteric. // LCOV_EXCL_START case value_t::discarded: { v.end_position = std::string::npos; v.start_position = v.end_position; break; } // LCOV_EXCL_STOP case value_t::binary: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: { v.start_position = v.end_position - m_lexer_ref->get_string().size(); break; } case value_t::object: case value_t::array: { // object and array are handled in start_object() and start_array() handlers // skip setting the values here. break; } default: // LCOV_EXCL_LINE // Handle all possible types discretely, default handler should never be reached. JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert,-warnings-as-errors) LCOV_EXCL_LINE } } } #endif /*! @invariant If the ref stack is empty, then the passed value will be the new root. @invariant If the ref stack contains a value, then it is an array or an object to which we can add elements */ template JSON_HEDLEY_RETURNS_NON_NULL BasicJsonType* handle_value(Value&& v) { if (ref_stack.empty()) { root = BasicJsonType(std::forward(v)); #if JSON_DIAGNOSTIC_POSITIONS handle_diagnostic_positions_for_json_value(root); #endif return &root; } JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object()); if (ref_stack.back()->is_array()) { ref_stack.back()->m_data.m_value.array->emplace_back(std::forward(v)); #if JSON_DIAGNOSTIC_POSITIONS handle_diagnostic_positions_for_json_value(ref_stack.back()->m_data.m_value.array->back()); #endif return &(ref_stack.back()->m_data.m_value.array->back()); } JSON_ASSERT(ref_stack.back()->is_object()); JSON_ASSERT(object_element); *object_element = BasicJsonType(std::forward(v)); #if JSON_DIAGNOSTIC_POSITIONS handle_diagnostic_positions_for_json_value(*object_element); #endif return object_element; } /// the parsed JSON value BasicJsonType& root; /// stack to model hierarchy of values std::vector ref_stack {}; /// helper to hold the reference for the next object element BasicJsonType* object_element = nullptr; /// whether a syntax error occurred bool errored = false; /// whether to throw exceptions in case of errors const bool allow_exceptions = true; /// the lexer reference to obtain the current position lexer_t* m_lexer_ref = nullptr; }; template class json_sax_dom_callback_parser { public: using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; using parser_callback_t = typename BasicJsonType::parser_callback_t; using parse_event_t = typename BasicJsonType::parse_event_t; using lexer_t = lexer; json_sax_dom_callback_parser(BasicJsonType& r, parser_callback_t cb, const bool allow_exceptions_ = true, lexer_t* lexer_ = nullptr) : root(r), callback(std::move(cb)), allow_exceptions(allow_exceptions_), m_lexer_ref(lexer_) { keep_stack.push_back(true); } // make class move-only json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete; json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete; json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) ~json_sax_dom_callback_parser() = default; bool null() { handle_value(nullptr); return true; } bool boolean(bool val) { handle_value(val); return true; } bool number_integer(number_integer_t val) { handle_value(val); return true; } bool number_unsigned(number_unsigned_t val) { handle_value(val); return true; } bool number_float(number_float_t val, const string_t& /*unused*/) { handle_value(val); return true; } bool string(string_t& val) { handle_value(val); return true; } bool binary(binary_t& val) { handle_value(std::move(val)); return true; } bool start_object(std::size_t len) { // check callback for object start const bool keep = callback(static_cast(ref_stack.size()), parse_event_t::object_start, discarded); keep_stack.push_back(keep); auto val = handle_value(BasicJsonType::value_t::object, true); ref_stack.push_back(val.second); if (ref_stack.back()) { #if JSON_DIAGNOSTIC_POSITIONS // Manually set the start position of the object here. // Ensure this is after the call to handle_value to ensure correct start position. if (m_lexer_ref) { // Lexer has read the first character of the object, so // subtract 1 from the position to get the correct start position. ref_stack.back()->start_position = m_lexer_ref->get_position() - 1; } #endif // check object limit if (JSON_HEDLEY_UNLIKELY(len != detail::unknown_size() && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, concat("excessive object size: ", std::to_string(len)), ref_stack.back())); } } return true; } bool key(string_t& val) { BasicJsonType k = BasicJsonType(val); // check callback for key const bool keep = callback(static_cast(ref_stack.size()), parse_event_t::key, k); key_keep_stack.push_back(keep); // add discarded value at given key and store the reference for later if (keep && ref_stack.back()) { object_element = &(ref_stack.back()->m_data.m_value.object->operator[](val) = discarded); } return true; } bool end_object() { if (ref_stack.back()) { if (!callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back())) { // discard object *ref_stack.back() = discarded; #if JSON_DIAGNOSTIC_POSITIONS // Set start/end positions for discarded object. handle_diagnostic_positions_for_json_value(*ref_stack.back()); #endif } else { #if JSON_DIAGNOSTIC_POSITIONS if (m_lexer_ref) { // Lexer's position is past the closing brace, so set that as the end position. ref_stack.back()->end_position = m_lexer_ref->get_position(); } #endif ref_stack.back()->set_parents(); } } JSON_ASSERT(!ref_stack.empty()); JSON_ASSERT(!keep_stack.empty()); ref_stack.pop_back(); keep_stack.pop_back(); if (!ref_stack.empty() && ref_stack.back() && ref_stack.back()->is_structured()) { // remove discarded value for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it) { if (it->is_discarded()) { ref_stack.back()->erase(it); break; } } } return true; } bool start_array(std::size_t len) { const bool keep = callback(static_cast(ref_stack.size()), parse_event_t::array_start, discarded); keep_stack.push_back(keep); auto val = handle_value(BasicJsonType::value_t::array, true); ref_stack.push_back(val.second); if (ref_stack.back()) { #if JSON_DIAGNOSTIC_POSITIONS // Manually set the start position of the array here. // Ensure this is after the call to handle_value to ensure correct start position. if (m_lexer_ref) { // Lexer has read the first character of the array, so // subtract 1 from the position to get the correct start position. ref_stack.back()->start_position = m_lexer_ref->get_position() - 1; } #endif // check array limit if (JSON_HEDLEY_UNLIKELY(len != detail::unknown_size() && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, concat("excessive array size: ", std::to_string(len)), ref_stack.back())); } } return true; } bool end_array() { bool keep = true; if (ref_stack.back()) { keep = callback(static_cast(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back()); if (keep) { #if JSON_DIAGNOSTIC_POSITIONS if (m_lexer_ref) { // Lexer's position is past the closing bracket, so set that as the end position. ref_stack.back()->end_position = m_lexer_ref->get_position(); } #endif ref_stack.back()->set_parents(); } else { // discard array *ref_stack.back() = discarded; #if JSON_DIAGNOSTIC_POSITIONS // Set start/end positions for discarded array. handle_diagnostic_positions_for_json_value(*ref_stack.back()); #endif } } JSON_ASSERT(!ref_stack.empty()); JSON_ASSERT(!keep_stack.empty()); ref_stack.pop_back(); keep_stack.pop_back(); // remove discarded value if (!keep && !ref_stack.empty() && ref_stack.back()->is_array()) { ref_stack.back()->m_data.m_value.array->pop_back(); } return true; } template bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const Exception& ex) { errored = true; static_cast(ex); if (allow_exceptions) { JSON_THROW(ex); } return false; } constexpr bool is_errored() const { return errored; } private: #if JSON_DIAGNOSTIC_POSITIONS void handle_diagnostic_positions_for_json_value(BasicJsonType& v) { if (m_lexer_ref) { // Lexer has read past the current field value, so set the end position to the current position. // The start position will be set below based on the length of the string representation // of the value. v.end_position = m_lexer_ref->get_position(); switch (v.type()) { case value_t::boolean: { // 4 and 5 are the string length of "true" and "false" v.start_position = v.end_position - (v.m_data.m_value.boolean ? 4 : 5); break; } case value_t::null: { // 4 is the string length of "null" v.start_position = v.end_position - 4; break; } case value_t::string: { // include the length of the quotes, which is 2 v.start_position = v.end_position - v.m_data.m_value.string->size() - 2; break; } case value_t::discarded: { v.end_position = std::string::npos; v.start_position = v.end_position; break; } case value_t::binary: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: { v.start_position = v.end_position - m_lexer_ref->get_string().size(); break; } case value_t::object: case value_t::array: { // object and array are handled in start_object() and start_array() handlers // skip setting the values here. break; } default: // LCOV_EXCL_LINE // Handle all possible types discretely, default handler should never be reached. JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert,-warnings-as-errors) LCOV_EXCL_LINE } } } #endif /*! @param[in] v value to add to the JSON value we build during parsing @param[in] skip_callback whether we should skip calling the callback function; this is required after start_array() and start_object() SAX events, because otherwise we would call the callback function with an empty array or object, respectively. @invariant If the ref stack is empty, then the passed value will be the new root. @invariant If the ref stack contains a value, then it is an array or an object to which we can add elements @return pair of boolean (whether value should be kept) and pointer (to the passed value in the ref_stack hierarchy; nullptr if not kept) */ template std::pair handle_value(Value&& v, const bool skip_callback = false) { JSON_ASSERT(!keep_stack.empty()); // do not handle this value if we know it would be added to a discarded // container if (!keep_stack.back()) { return {false, nullptr}; } // create value auto value = BasicJsonType(std::forward(v)); #if JSON_DIAGNOSTIC_POSITIONS handle_diagnostic_positions_for_json_value(value); #endif // check callback const bool keep = skip_callback || callback(static_cast(ref_stack.size()), parse_event_t::value, value); // do not handle this value if we just learnt it shall be discarded if (!keep) { return {false, nullptr}; } if (ref_stack.empty()) { root = std::move(value); return {true, & root}; } // skip this value if we already decided to skip the parent // (https://github.com/nlohmann/json/issues/971#issuecomment-413678360) if (!ref_stack.back()) { return {false, nullptr}; } // we now only expect arrays and objects JSON_ASSERT(ref_stack.back()->is_array() || ref_stack.back()->is_object()); // array if (ref_stack.back()->is_array()) { ref_stack.back()->m_data.m_value.array->emplace_back(std::move(value)); return {true, & (ref_stack.back()->m_data.m_value.array->back())}; } // object JSON_ASSERT(ref_stack.back()->is_object()); // check if we should store an element for the current key JSON_ASSERT(!key_keep_stack.empty()); const bool store_element = key_keep_stack.back(); key_keep_stack.pop_back(); if (!store_element) { return {false, nullptr}; } JSON_ASSERT(object_element); *object_element = std::move(value); return {true, object_element}; } /// the parsed JSON value BasicJsonType& root; /// stack to model hierarchy of values std::vector ref_stack {}; /// stack to manage which values to keep std::vector keep_stack {}; // NOLINT(readability-redundant-member-init) /// stack to manage which object keys to keep std::vector key_keep_stack {}; // NOLINT(readability-redundant-member-init) /// helper to hold the reference for the next object element BasicJsonType* object_element = nullptr; /// whether a syntax error occurred bool errored = false; /// callback function const parser_callback_t callback = nullptr; /// whether to throw exceptions in case of errors const bool allow_exceptions = true; /// a discarded value for the callback BasicJsonType discarded = BasicJsonType::value_t::discarded; /// the lexer reference to obtain the current position lexer_t* m_lexer_ref = nullptr; }; template class json_sax_acceptor { public: using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; bool null() { return true; } bool boolean(bool /*unused*/) { return true; } bool number_integer(number_integer_t /*unused*/) { return true; } bool number_unsigned(number_unsigned_t /*unused*/) { return true; } bool number_float(number_float_t /*unused*/, const string_t& /*unused*/) { return true; } bool string(string_t& /*unused*/) { return true; } bool binary(binary_t& /*unused*/) { return true; } bool start_object(std::size_t /*unused*/ = detail::unknown_size()) { return true; } bool key(string_t& /*unused*/) { return true; } bool end_object() { return true; } bool start_array(std::size_t /*unused*/ = detail::unknown_size()) { return true; } bool end_array() { return true; } bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/) { return false; } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/lexer.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // array #include // localeconv #include // size_t #include // snprintf #include // strtof, strtod, strtold, strtoll, strtoull #include // initializer_list #include // char_traits, string #include // move #include // vector #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /////////// // lexer // /////////// template class lexer_base { public: /// token types for the parser enum class token_type { uninitialized, ///< indicating the scanner is uninitialized literal_true, ///< the `true` literal literal_false, ///< the `false` literal literal_null, ///< the `null` literal value_string, ///< a string -- use get_string() for actual value value_unsigned, ///< an unsigned integer -- use get_number_unsigned() for actual value value_integer, ///< a signed integer -- use get_number_integer() for actual value value_float, ///< an floating point number -- use get_number_float() for actual value begin_array, ///< the character for array begin `[` begin_object, ///< the character for object begin `{` end_array, ///< the character for array end `]` end_object, ///< the character for object end `}` name_separator, ///< the name separator `:` value_separator, ///< the value separator `,` parse_error, ///< indicating a parse error end_of_input, ///< indicating the end of the input buffer literal_or_value ///< a literal or the begin of a value (only for diagnostics) }; /// return name of values of type token_type (only used for errors) JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_CONST static const char* token_type_name(const token_type t) noexcept { switch (t) { case token_type::uninitialized: return ""; case token_type::literal_true: return "true literal"; case token_type::literal_false: return "false literal"; case token_type::literal_null: return "null literal"; case token_type::value_string: return "string literal"; case token_type::value_unsigned: case token_type::value_integer: case token_type::value_float: return "number literal"; case token_type::begin_array: return "'['"; case token_type::begin_object: return "'{'"; case token_type::end_array: return "']'"; case token_type::end_object: return "'}'"; case token_type::name_separator: return "':'"; case token_type::value_separator: return "','"; case token_type::parse_error: return ""; case token_type::end_of_input: return "end of input"; case token_type::literal_or_value: return "'[', '{', or a literal"; // LCOV_EXCL_START default: // catch non-enum values return "unknown token"; // LCOV_EXCL_STOP } } }; /*! @brief lexical analysis This class organizes the lexical analysis during JSON deserialization. */ template class lexer : public lexer_base { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using char_type = typename InputAdapterType::char_type; using char_int_type = typename char_traits::int_type; public: using token_type = typename lexer_base::token_type; explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ = false) noexcept : ia(std::move(adapter)) , ignore_comments(ignore_comments_) , decimal_point_char(static_cast(get_decimal_point())) {} // delete because of pointer members lexer(const lexer&) = delete; lexer(lexer&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) lexer& operator=(lexer&) = delete; lexer& operator=(lexer&&) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor) ~lexer() = default; private: ///////////////////// // locales ///////////////////// /// return the locale-dependent decimal point JSON_HEDLEY_PURE static char get_decimal_point() noexcept { const auto* loc = localeconv(); JSON_ASSERT(loc != nullptr); return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point); } ///////////////////// // scan functions ///////////////////// /*! @brief get codepoint from 4 hex characters following `\u` For input "\u c1 c2 c3 c4" the codepoint is: (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4 = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0) Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f' must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The conversion is done by subtracting the offset (0x30, 0x37, and 0x57) between the ASCII value of the character and the desired integer value. @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or non-hex character) */ int get_codepoint() { // this function only makes sense after reading `\u` JSON_ASSERT(current == 'u'); int codepoint = 0; const auto factors = { 12u, 8u, 4u, 0u }; for (const auto factor : factors) { get(); if (current >= '0' && current <= '9') { codepoint += static_cast((static_cast(current) - 0x30u) << factor); } else if (current >= 'A' && current <= 'F') { codepoint += static_cast((static_cast(current) - 0x37u) << factor); } else if (current >= 'a' && current <= 'f') { codepoint += static_cast((static_cast(current) - 0x57u) << factor); } else { return -1; } } JSON_ASSERT(0x0000 <= codepoint && codepoint <= 0xFFFF); return codepoint; } /*! @brief check if the next byte(s) are inside a given range Adds the current byte and, for each passed range, reads a new byte and checks if it is inside the range. If a violation was detected, set up an error message and return false. Otherwise, return true. @param[in] ranges list of integers; interpreted as list of pairs of inclusive lower and upper bound, respectively @pre The passed list @a ranges must have 2, 4, or 6 elements; that is, 1, 2, or 3 pairs. This precondition is enforced by an assertion. @return true if and only if no range violation was detected */ bool next_byte_in_range(std::initializer_list ranges) { JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6); add(current); for (auto range = ranges.begin(); range != ranges.end(); ++range) { get(); if (JSON_HEDLEY_LIKELY(*range <= current && current <= *(++range))) // NOLINT(bugprone-inc-dec-in-conditions) { add(current); } else { error_message = "invalid string: ill-formed UTF-8 byte"; return false; } } return true; } /*! @brief scan a string literal This function scans a string according to Sect. 7 of RFC 8259. While scanning, bytes are escaped and copied into buffer token_buffer. Then the function returns successfully, token_buffer is *not* null-terminated (as it may contain \0 bytes), and token_buffer.size() is the number of bytes in the string. @return token_type::value_string if string could be successfully scanned, token_type::parse_error otherwise @note In case of errors, variable error_message contains a textual description. */ token_type scan_string() { // reset token_buffer (ignore opening quote) reset(); // we entered the function by reading an open quote JSON_ASSERT(current == '\"'); while (true) { // get next character switch (get()) { // end of file while parsing string case char_traits::eof(): { error_message = "invalid string: missing closing quote"; return token_type::parse_error; } // closing quote case '\"': { return token_type::value_string; } // escapes case '\\': { switch (get()) { // quotation mark case '\"': add('\"'); break; // reverse solidus case '\\': add('\\'); break; // solidus case '/': add('/'); break; // backspace case 'b': add('\b'); break; // form feed case 'f': add('\f'); break; // line feed case 'n': add('\n'); break; // carriage return case 'r': add('\r'); break; // tab case 't': add('\t'); break; // unicode escapes case 'u': { const int codepoint1 = get_codepoint(); int codepoint = codepoint1; // start with codepoint1 if (JSON_HEDLEY_UNLIKELY(codepoint1 == -1)) { error_message = "invalid string: '\\u' must be followed by 4 hex digits"; return token_type::parse_error; } // check if code point is a high surrogate if (0xD800 <= codepoint1 && codepoint1 <= 0xDBFF) { // expect next \uxxxx entry if (JSON_HEDLEY_LIKELY(get() == '\\' && get() == 'u')) { const int codepoint2 = get_codepoint(); if (JSON_HEDLEY_UNLIKELY(codepoint2 == -1)) { error_message = "invalid string: '\\u' must be followed by 4 hex digits"; return token_type::parse_error; } // check if codepoint2 is a low surrogate if (JSON_HEDLEY_LIKELY(0xDC00 <= codepoint2 && codepoint2 <= 0xDFFF)) { // overwrite codepoint codepoint = static_cast( // high surrogate occupies the most significant 22 bits (static_cast(codepoint1) << 10u) // low surrogate occupies the least significant 15 bits + static_cast(codepoint2) // there is still the 0xD800, 0xDC00 and 0x10000 noise // in the result, so we have to subtract with: // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 - 0x35FDC00u); } else { error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } else { error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } else { if (JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 && codepoint1 <= 0xDFFF)) { error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; return token_type::parse_error; } } // result of the above calculation yields a proper codepoint JSON_ASSERT(0x00 <= codepoint && codepoint <= 0x10FFFF); // translate codepoint into bytes if (codepoint < 0x80) { // 1-byte characters: 0xxxxxxx (ASCII) add(static_cast(codepoint)); } else if (codepoint <= 0x7FF) { // 2-byte characters: 110xxxxx 10xxxxxx add(static_cast(0xC0u | (static_cast(codepoint) >> 6u))); add(static_cast(0x80u | (static_cast(codepoint) & 0x3Fu))); } else if (codepoint <= 0xFFFF) { // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx add(static_cast(0xE0u | (static_cast(codepoint) >> 12u))); add(static_cast(0x80u | ((static_cast(codepoint) >> 6u) & 0x3Fu))); add(static_cast(0x80u | (static_cast(codepoint) & 0x3Fu))); } else { // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx add(static_cast(0xF0u | (static_cast(codepoint) >> 18u))); add(static_cast(0x80u | ((static_cast(codepoint) >> 12u) & 0x3Fu))); add(static_cast(0x80u | ((static_cast(codepoint) >> 6u) & 0x3Fu))); add(static_cast(0x80u | (static_cast(codepoint) & 0x3Fu))); } break; } // other characters after escape default: error_message = "invalid string: forbidden character after backslash"; return token_type::parse_error; } break; } // invalid control characters case 0x00: { error_message = "invalid string: control character U+0000 (NUL) must be escaped to \\u0000"; return token_type::parse_error; } case 0x01: { error_message = "invalid string: control character U+0001 (SOH) must be escaped to \\u0001"; return token_type::parse_error; } case 0x02: { error_message = "invalid string: control character U+0002 (STX) must be escaped to \\u0002"; return token_type::parse_error; } case 0x03: { error_message = "invalid string: control character U+0003 (ETX) must be escaped to \\u0003"; return token_type::parse_error; } case 0x04: { error_message = "invalid string: control character U+0004 (EOT) must be escaped to \\u0004"; return token_type::parse_error; } case 0x05: { error_message = "invalid string: control character U+0005 (ENQ) must be escaped to \\u0005"; return token_type::parse_error; } case 0x06: { error_message = "invalid string: control character U+0006 (ACK) must be escaped to \\u0006"; return token_type::parse_error; } case 0x07: { error_message = "invalid string: control character U+0007 (BEL) must be escaped to \\u0007"; return token_type::parse_error; } case 0x08: { error_message = "invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b"; return token_type::parse_error; } case 0x09: { error_message = "invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t"; return token_type::parse_error; } case 0x0A: { error_message = "invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n"; return token_type::parse_error; } case 0x0B: { error_message = "invalid string: control character U+000B (VT) must be escaped to \\u000B"; return token_type::parse_error; } case 0x0C: { error_message = "invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f"; return token_type::parse_error; } case 0x0D: { error_message = "invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r"; return token_type::parse_error; } case 0x0E: { error_message = "invalid string: control character U+000E (SO) must be escaped to \\u000E"; return token_type::parse_error; } case 0x0F: { error_message = "invalid string: control character U+000F (SI) must be escaped to \\u000F"; return token_type::parse_error; } case 0x10: { error_message = "invalid string: control character U+0010 (DLE) must be escaped to \\u0010"; return token_type::parse_error; } case 0x11: { error_message = "invalid string: control character U+0011 (DC1) must be escaped to \\u0011"; return token_type::parse_error; } case 0x12: { error_message = "invalid string: control character U+0012 (DC2) must be escaped to \\u0012"; return token_type::parse_error; } case 0x13: { error_message = "invalid string: control character U+0013 (DC3) must be escaped to \\u0013"; return token_type::parse_error; } case 0x14: { error_message = "invalid string: control character U+0014 (DC4) must be escaped to \\u0014"; return token_type::parse_error; } case 0x15: { error_message = "invalid string: control character U+0015 (NAK) must be escaped to \\u0015"; return token_type::parse_error; } case 0x16: { error_message = "invalid string: control character U+0016 (SYN) must be escaped to \\u0016"; return token_type::parse_error; } case 0x17: { error_message = "invalid string: control character U+0017 (ETB) must be escaped to \\u0017"; return token_type::parse_error; } case 0x18: { error_message = "invalid string: control character U+0018 (CAN) must be escaped to \\u0018"; return token_type::parse_error; } case 0x19: { error_message = "invalid string: control character U+0019 (EM) must be escaped to \\u0019"; return token_type::parse_error; } case 0x1A: { error_message = "invalid string: control character U+001A (SUB) must be escaped to \\u001A"; return token_type::parse_error; } case 0x1B: { error_message = "invalid string: control character U+001B (ESC) must be escaped to \\u001B"; return token_type::parse_error; } case 0x1C: { error_message = "invalid string: control character U+001C (FS) must be escaped to \\u001C"; return token_type::parse_error; } case 0x1D: { error_message = "invalid string: control character U+001D (GS) must be escaped to \\u001D"; return token_type::parse_error; } case 0x1E: { error_message = "invalid string: control character U+001E (RS) must be escaped to \\u001E"; return token_type::parse_error; } case 0x1F: { error_message = "invalid string: control character U+001F (US) must be escaped to \\u001F"; return token_type::parse_error; } // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace)) case 0x20: case 0x21: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B: case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: case 0x3A: case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F: case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E: case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: case 0x58: case 0x59: case 0x5A: case 0x5B: case 0x5D: case 0x5E: case 0x5F: case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6E: case 0x6F: case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: case 0x78: case 0x79: case 0x7A: case 0x7B: case 0x7C: case 0x7D: case 0x7E: case 0x7F: { add(current); break; } // U+0080..U+07FF: bytes C2..DF 80..BF case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: case 0xC8: case 0xC9: case 0xCA: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: case 0xD0: case 0xD1: case 0xD2: case 0xD3: case 0xD4: case 0xD5: case 0xD6: case 0xD7: case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDD: case 0xDE: case 0xDF: { if (JSON_HEDLEY_UNLIKELY(!next_byte_in_range({0x80, 0xBF}))) { return token_type::parse_error; } break; } // U+0800..U+0FFF: bytes E0 A0..BF 80..BF case 0xE0: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF case 0xE1: case 0xE2: case 0xE3: case 0xE4: case 0xE5: case 0xE6: case 0xE7: case 0xE8: case 0xE9: case 0xEA: case 0xEB: case 0xEC: case 0xEE: case 0xEF: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+D000..U+D7FF: bytes ED 80..9F 80..BF case 0xED: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x9F, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF case 0xF0: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF case 0xF1: case 0xF2: case 0xF3: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF case 0xF4: { if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF})))) { return token_type::parse_error; } break; } // remaining bytes (80..C1 and F5..FF) are ill-formed default: { error_message = "invalid string: ill-formed UTF-8 byte"; return token_type::parse_error; } } } } /*! * @brief scan a comment * @return whether comment could be scanned successfully */ bool scan_comment() { switch (get()) { // single-line comments skip input until a newline or EOF is read case '/': { while (true) { switch (get()) { case '\n': case '\r': case char_traits::eof(): case '\0': return true; default: break; } } } // multi-line comments skip input until */ is read case '*': { while (true) { switch (get()) { case char_traits::eof(): case '\0': { error_message = "invalid comment; missing closing '*/'"; return false; } case '*': { switch (get()) { case '/': return true; default: { unget(); continue; } } } default: continue; } } } // unexpected character after reading '/' default: { error_message = "invalid comment; expecting '/' or '*' after '/'"; return false; } } } JSON_HEDLEY_NON_NULL(2) static void strtof(float& f, const char* str, char** endptr) noexcept { f = std::strtof(str, endptr); } JSON_HEDLEY_NON_NULL(2) static void strtof(double& f, const char* str, char** endptr) noexcept { f = std::strtod(str, endptr); } JSON_HEDLEY_NON_NULL(2) static void strtof(long double& f, const char* str, char** endptr) noexcept { f = std::strtold(str, endptr); } /*! @brief scan a number literal This function scans a string according to Sect. 6 of RFC 8259. The function is realized with a deterministic finite state machine derived from the grammar described in RFC 8259. Starting in state "init", the input is read and used to determined the next state. Only state "done" accepts the number. State "error" is a trap state to model errors. In the table below, "anything" means any character but the ones listed before. state | 0 | 1-9 | e E | + | - | . | anything ---------|----------|----------|----------|---------|---------|----------|----------- init | zero | any1 | [error] | [error] | minus | [error] | [error] minus | zero | any1 | [error] | [error] | [error] | [error] | [error] zero | done | done | exponent | done | done | decimal1 | done any1 | any1 | any1 | exponent | done | done | decimal1 | done decimal1 | decimal2 | decimal2 | [error] | [error] | [error] | [error] | [error] decimal2 | decimal2 | decimal2 | exponent | done | done | done | done exponent | any2 | any2 | [error] | sign | sign | [error] | [error] sign | any2 | any2 | [error] | [error] | [error] | [error] | [error] any2 | any2 | any2 | done | done | done | done | done The state machine is realized with one label per state (prefixed with "scan_number_") and `goto` statements between them. The state machine contains cycles, but any cycle can be left when EOF is read. Therefore, the function is guaranteed to terminate. During scanning, the read bytes are stored in token_buffer. This string is then converted to a signed integer, an unsigned integer, or a floating-point number. @return token_type::value_unsigned, token_type::value_integer, or token_type::value_float if number could be successfully scanned, token_type::parse_error otherwise @note The scanner is independent of the current locale. Internally, the locale's decimal point is used instead of `.` to work with the locale-dependent converters. */ token_type scan_number() // lgtm [cpp/use-of-goto] `goto` is used in this function to implement the number-parsing state machine described above. By design, any finite input will eventually reach the "done" state or return token_type::parse_error. In each intermediate state, 1 byte of the input is appended to the token_buffer vector, and only the already initialized variables token_buffer, number_type, and error_message are manipulated. { // reset token_buffer to store the number's bytes reset(); // the type of the parsed number; initially set to unsigned; will be // changed if minus sign, decimal point or exponent is read token_type number_type = token_type::value_unsigned; // state (init): we just found out we need to scan a number switch (current) { case '-': { add(current); goto scan_number_minus; } case '0': { add(current); goto scan_number_zero; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } // all other characters are rejected outside scan_number() default: // LCOV_EXCL_LINE JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE } scan_number_minus: // state: we just parsed a leading minus sign number_type = token_type::value_integer; switch (get()) { case '0': { add(current); goto scan_number_zero; } case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } default: { error_message = "invalid number; expected digit after '-'"; return token_type::parse_error; } } scan_number_zero: // state: we just parse a zero (maybe with a leading minus sign) switch (get()) { case '.': { add(decimal_point_char); decimal_point_position = token_buffer.size() - 1; goto scan_number_decimal1; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_any1: // state: we just parsed a number 0-9 (maybe with a leading minus sign) switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any1; } case '.': { add(decimal_point_char); decimal_point_position = token_buffer.size() - 1; goto scan_number_decimal1; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_decimal1: // state: we just parsed a decimal point number_type = token_type::value_float; switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_decimal2; } default: { error_message = "invalid number; expected digit after '.'"; return token_type::parse_error; } } scan_number_decimal2: // we just parsed at least one number after a decimal point switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_decimal2; } case 'e': case 'E': { add(current); goto scan_number_exponent; } default: goto scan_number_done; } scan_number_exponent: // we just parsed an exponent number_type = token_type::value_float; switch (get()) { case '+': case '-': { add(current); goto scan_number_sign; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: { error_message = "invalid number; expected '+', '-', or digit after exponent"; return token_type::parse_error; } } scan_number_sign: // we just parsed an exponent sign switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: { error_message = "invalid number; expected digit after exponent sign"; return token_type::parse_error; } } scan_number_any2: // we just parsed a number after the exponent or exponent sign switch (get()) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { add(current); goto scan_number_any2; } default: goto scan_number_done; } scan_number_done: // unget the character after the number (we only read it to know that // we are done scanning a number) unget(); char* endptr = nullptr; // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) errno = 0; // try to parse integers first and fall back to floats if (number_type == token_type::value_unsigned) { const auto x = std::strtoull(token_buffer.data(), &endptr, 10); // we checked the number format before JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size()); if (errno != ERANGE) { value_unsigned = static_cast(x); if (value_unsigned == x) { return token_type::value_unsigned; } } } else if (number_type == token_type::value_integer) { const auto x = std::strtoll(token_buffer.data(), &endptr, 10); // we checked the number format before JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size()); if (errno != ERANGE) { value_integer = static_cast(x); if (value_integer == x) { return token_type::value_integer; } } } // this code is reached if we parse a floating-point number or if an // integer conversion above failed strtof(value_float, token_buffer.data(), &endptr); // we checked the number format before JSON_ASSERT(endptr == token_buffer.data() + token_buffer.size()); return token_type::value_float; } /*! @param[in] literal_text the literal text to expect @param[in] length the length of the passed literal text @param[in] return_type the token type to return on success */ JSON_HEDLEY_NON_NULL(2) token_type scan_literal(const char_type* literal_text, const std::size_t length, token_type return_type) { JSON_ASSERT(char_traits::to_char_type(current) == literal_text[0]); for (std::size_t i = 1; i < length; ++i) { if (JSON_HEDLEY_UNLIKELY(char_traits::to_char_type(get()) != literal_text[i])) { error_message = "invalid literal"; return token_type::parse_error; } } return return_type; } ///////////////////// // input management ///////////////////// /// reset token_buffer; current character is beginning of token void reset() noexcept { token_buffer.clear(); token_string.clear(); decimal_point_position = std::string::npos; token_string.push_back(char_traits::to_char_type(current)); } /* @brief get next character from the input This function provides the interface to the used input adapter. It does not throw in case the input reached EOF, but returns a `char_traits::eof()` in that case. Stores the scanned characters for use in error messages. @return character read from the input */ char_int_type get() { ++position.chars_read_total; ++position.chars_read_current_line; if (next_unget) { // just reset the next_unget variable and work with current next_unget = false; } else { current = ia.get_character(); } if (JSON_HEDLEY_LIKELY(current != char_traits::eof())) { token_string.push_back(char_traits::to_char_type(current)); } if (current == '\n') { ++position.lines_read; position.chars_read_current_line = 0; } return current; } /*! @brief unget current character (read it again on next get) We implement unget by setting variable next_unget to true. The input is not changed - we just simulate ungetting by modifying chars_read_total, chars_read_current_line, and token_string. The next call to get() will behave as if the unget character is read again. */ void unget() { next_unget = true; --position.chars_read_total; // in case we "unget" a newline, we have to also decrement the lines_read if (position.chars_read_current_line == 0) { if (position.lines_read > 0) { --position.lines_read; } } else { --position.chars_read_current_line; } if (JSON_HEDLEY_LIKELY(current != char_traits::eof())) { JSON_ASSERT(!token_string.empty()); token_string.pop_back(); } } /// add a character to token_buffer void add(char_int_type c) { token_buffer.push_back(static_cast(c)); } public: ///////////////////// // value getters ///////////////////// /// return integer value constexpr number_integer_t get_number_integer() const noexcept { return value_integer; } /// return unsigned integer value constexpr number_unsigned_t get_number_unsigned() const noexcept { return value_unsigned; } /// return floating-point value constexpr number_float_t get_number_float() const noexcept { return value_float; } /// return current string value (implicitly resets the token; useful only once) string_t& get_string() { // translate decimal points from locale back to '.' (#4084) if (decimal_point_char != '.' && decimal_point_position != std::string::npos) { token_buffer[decimal_point_position] = '.'; } return token_buffer; } ///////////////////// // diagnostics ///////////////////// /// return position of last read token constexpr position_t get_position() const noexcept { return position; } /// return the last read token (for errors only). Will never contain EOF /// (an arbitrary value that is not a valid char value, often -1), because /// 255 may legitimately occur. May contain NUL, which should be escaped. std::string get_token_string() const { // escape control characters std::string result; for (const auto c : token_string) { if (static_cast(c) <= '\x1F') { // escape control characters std::array cs{{}}; static_cast((std::snprintf)(cs.data(), cs.size(), "", static_cast(c))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg) result += cs.data(); } else { // add character as is result.push_back(static_cast(c)); } } return result; } /// return syntax error message JSON_HEDLEY_RETURNS_NON_NULL constexpr const char* get_error_message() const noexcept { return error_message; } ///////////////////// // actual scanner ///////////////////// /*! @brief skip the UTF-8 byte order mark @return true iff there is no BOM or the correct BOM has been skipped */ bool skip_bom() { if (get() == 0xEF) { // check if we completely parse the BOM return get() == 0xBB && get() == 0xBF; } // the first character is not the beginning of the BOM; unget it to // process is later unget(); return true; } void skip_whitespace() { do { get(); } while (current == ' ' || current == '\t' || current == '\n' || current == '\r'); } token_type scan() { // initially, skip the BOM if (position.chars_read_total == 0 && !skip_bom()) { error_message = "invalid BOM; must be 0xEF 0xBB 0xBF if given"; return token_type::parse_error; } // read next character and ignore whitespace skip_whitespace(); // ignore comments while (ignore_comments && current == '/') { if (!scan_comment()) { return token_type::parse_error; } // skip following whitespace skip_whitespace(); } switch (current) { // structural characters case '[': return token_type::begin_array; case ']': return token_type::end_array; case '{': return token_type::begin_object; case '}': return token_type::end_object; case ':': return token_type::name_separator; case ',': return token_type::value_separator; // literals case 't': { std::array true_literal = {{static_cast('t'), static_cast('r'), static_cast('u'), static_cast('e')}}; return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true); } case 'f': { std::array false_literal = {{static_cast('f'), static_cast('a'), static_cast('l'), static_cast('s'), static_cast('e')}}; return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false); } case 'n': { std::array null_literal = {{static_cast('n'), static_cast('u'), static_cast('l'), static_cast('l')}}; return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null); } // string case '\"': return scan_string(); // number case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return scan_number(); // end of input (the null byte is needed when parsing from // string literals) case '\0': case char_traits::eof(): return token_type::end_of_input; // error default: error_message = "invalid literal"; return token_type::parse_error; } } private: /// input adapter InputAdapterType ia; /// whether comments should be ignored (true) or signaled as errors (false) const bool ignore_comments = false; /// the current character char_int_type current = char_traits::eof(); /// whether the next get() call should just return current bool next_unget = false; /// the start position of the current token position_t position {}; /// raw input token string (for error messages) std::vector token_string {}; /// buffer for variable-length tokens (numbers, strings) string_t token_buffer {}; /// a description of occurred lexer errors const char* error_message = ""; // number values number_integer_t value_integer = 0; number_unsigned_t value_unsigned = 0; number_float_t value_float = 0; /// the decimal point const char_int_type decimal_point_char = '.'; /// the position of the decimal point in the input std::size_t decimal_point_position = std::string::npos; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/parser.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // isfinite #include // uint8_t #include // function #include // string #include // move #include // vector #include #include #include #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { //////////// // parser // //////////// enum class parse_event_t : std::uint8_t { /// the parser read `{` and started to process a JSON object object_start, /// the parser read `}` and finished processing a JSON object object_end, /// the parser read `[` and started to process a JSON array array_start, /// the parser read `]` and finished processing a JSON array array_end, /// the parser read a key of a value in an object key, /// the parser finished reading a JSON value value }; template using parser_callback_t = std::function; /*! @brief syntax analysis This class implements a recursive descent parser. */ template class parser { using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using lexer_t = lexer; using token_type = typename lexer_t::token_type; public: /// a parser reading from an input adapter explicit parser(InputAdapterType&& adapter, parser_callback_t cb = nullptr, const bool allow_exceptions_ = true, const bool skip_comments = false) : callback(std::move(cb)) , m_lexer(std::move(adapter), skip_comments) , allow_exceptions(allow_exceptions_) { // read first token get_token(); } /*! @brief public parser interface @param[in] strict whether to expect the last token to be EOF @param[in,out] result parsed JSON value @throw parse_error.101 in case of an unexpected token @throw parse_error.102 if to_unicode fails or surrogate error @throw parse_error.103 if to_unicode fails */ void parse(const bool strict, BasicJsonType& result) { if (callback) { json_sax_dom_callback_parser sdp(result, callback, allow_exceptions, &m_lexer); sax_parse_internal(&sdp); // in strict mode, input must be completely read if (strict && (get_token() != token_type::end_of_input)) { sdp.parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_of_input, "value"), nullptr)); } // in case of an error, return discarded value if (sdp.is_errored()) { result = value_t::discarded; return; } // set top-level value to null if it was discarded by the callback // function if (result.is_discarded()) { result = nullptr; } } else { json_sax_dom_parser sdp(result, allow_exceptions, &m_lexer); sax_parse_internal(&sdp); // in strict mode, input must be completely read if (strict && (get_token() != token_type::end_of_input)) { sdp.parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_of_input, "value"), nullptr)); } // in case of an error, return discarded value if (sdp.is_errored()) { result = value_t::discarded; return; } } result.assert_invariant(); } /*! @brief public accept interface @param[in] strict whether to expect the last token to be EOF @return whether the input is a proper JSON text */ bool accept(const bool strict = true) { json_sax_acceptor sax_acceptor; return sax_parse(&sax_acceptor, strict); } template JSON_HEDLEY_NON_NULL(2) bool sax_parse(SAX* sax, const bool strict = true) { (void)detail::is_sax_static_asserts {}; const bool result = sax_parse_internal(sax); // strict mode: next byte must be EOF if (result && strict && (get_token() != token_type::end_of_input)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_of_input, "value"), nullptr)); } return result; } private: template JSON_HEDLEY_NON_NULL(2) bool sax_parse_internal(SAX* sax) { // stack to remember the hierarchy of structured values we are parsing // true = array; false = object std::vector states; // value to avoid a goto (see comment where set to true) bool skip_to_state_evaluation = false; while (true) { if (!skip_to_state_evaluation) { // invariant: get_token() was called before each iteration switch (last_token) { case token_type::begin_object: { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(detail::unknown_size()))) { return false; } // closing } -> we are done if (get_token() == token_type::end_object) { if (JSON_HEDLEY_UNLIKELY(!sax->end_object())) { return false; } break; } // parse key if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"), nullptr)); } if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string()))) { return false; } // parse separator (:) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"), nullptr)); } // remember we are now inside an object states.push_back(false); // parse values get_token(); continue; } case token_type::begin_array: { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(detail::unknown_size()))) { return false; } // closing ] -> we are done if (get_token() == token_type::end_array) { if (JSON_HEDLEY_UNLIKELY(!sax->end_array())) { return false; } break; } // remember we are now inside an array states.push_back(true); // parse values (no need to call get_token) continue; } case token_type::value_float: { const auto res = m_lexer.get_number_float(); if (JSON_HEDLEY_UNLIKELY(!std::isfinite(res))) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), out_of_range::create(406, concat("number overflow parsing '", m_lexer.get_token_string(), '\''), nullptr)); } if (JSON_HEDLEY_UNLIKELY(!sax->number_float(res, m_lexer.get_string()))) { return false; } break; } case token_type::literal_false: { if (JSON_HEDLEY_UNLIKELY(!sax->boolean(false))) { return false; } break; } case token_type::literal_null: { if (JSON_HEDLEY_UNLIKELY(!sax->null())) { return false; } break; } case token_type::literal_true: { if (JSON_HEDLEY_UNLIKELY(!sax->boolean(true))) { return false; } break; } case token_type::value_integer: { if (JSON_HEDLEY_UNLIKELY(!sax->number_integer(m_lexer.get_number_integer()))) { return false; } break; } case token_type::value_string: { if (JSON_HEDLEY_UNLIKELY(!sax->string(m_lexer.get_string()))) { return false; } break; } case token_type::value_unsigned: { if (JSON_HEDLEY_UNLIKELY(!sax->number_unsigned(m_lexer.get_number_unsigned()))) { return false; } break; } case token_type::parse_error: { // using "uninitialized" to avoid "expected" message return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::uninitialized, "value"), nullptr)); } case token_type::end_of_input: { if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), "attempting to parse an empty input; check that your input string or stream contains the expected JSON", nullptr)); } return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr)); } case token_type::uninitialized: case token_type::end_array: case token_type::end_object: case token_type::name_separator: case token_type::value_separator: case token_type::literal_or_value: default: // the last token was unexpected { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr)); } } } else { skip_to_state_evaluation = false; } // we reached this line after we successfully parsed a value if (states.empty()) { // empty stack: we reached the end of the hierarchy: done return true; } if (states.back()) // array { // comma -> next value if (get_token() == token_type::value_separator) { // parse a new value get_token(); continue; } // closing ] if (JSON_HEDLEY_LIKELY(last_token == token_type::end_array)) { if (JSON_HEDLEY_UNLIKELY(!sax->end_array())) { return false; } // We are done with this array. Before we can parse a // new value, we need to evaluate the new state first. // By setting skip_to_state_evaluation to false, we // are effectively jumping to the beginning of this if. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true; continue; } return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_array, "array"), nullptr)); } // states.back() is false -> object // comma -> next value if (get_token() == token_type::value_separator) { // parse key if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::value_string, "object key"), nullptr)); } if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string()))) { return false; } // parse separator (:) if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::name_separator, "object separator"), nullptr)); } // parse values get_token(); continue; } // closing } if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object)) { if (JSON_HEDLEY_UNLIKELY(!sax->end_object())) { return false; } // We are done with this object. Before we can parse a // new value, we need to evaluate the new state first. // By setting skip_to_state_evaluation to false, we // are effectively jumping to the beginning of this if. JSON_ASSERT(!states.empty()); states.pop_back(); skip_to_state_evaluation = true; continue; } return sax->parse_error(m_lexer.get_position(), m_lexer.get_token_string(), parse_error::create(101, m_lexer.get_position(), exception_message(token_type::end_object, "object"), nullptr)); } } /// get next token from lexer token_type get_token() { return last_token = m_lexer.scan(); } std::string exception_message(const token_type expected, const std::string& context) { std::string error_msg = "syntax error "; if (!context.empty()) { error_msg += concat("while parsing ", context, ' '); } error_msg += "- "; if (last_token == token_type::parse_error) { error_msg += concat(m_lexer.get_error_message(), "; last read: '", m_lexer.get_token_string(), '\''); } else { error_msg += concat("unexpected ", lexer_t::token_type_name(last_token)); } if (expected != token_type::uninitialized) { error_msg += concat("; expected ", lexer_t::token_type_name(expected)); } return error_msg; } private: /// callback function const parser_callback_t callback = nullptr; /// the type of the last read token token_type last_token = token_type::uninitialized; /// the lexer lexer_t m_lexer; /// whether to throw exceptions in case of errors const bool allow_exceptions = true; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/input/position_t.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // size_t #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /// struct to capture the start position of the current token struct position_t { /// the total number of characters read std::size_t chars_read_total = 0; /// the number of characters read in the current line std::size_t chars_read_current_line = 0; /// the number of lines read std::size_t lines_read = 0; /// conversion to size_t to preserve SAX interface constexpr operator size_t() const { return chars_read_total; } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/internal_iterator.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /*! @brief an iterator value @note This structure could easily be a union, but MSVC currently does not allow unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. */ template struct internal_iterator { /// iterator for JSON objects typename BasicJsonType::object_t::iterator object_iterator {}; /// iterator for JSON arrays typename BasicJsonType::array_t::iterator array_iterator {}; /// generic iterator for all other types primitive_iterator_t primitive_iterator {}; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/iter_impl.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next #include // conditional, is_const, remove_const #include #include #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // forward declare, to be able to friend it later on template class iteration_proxy; template class iteration_proxy_value; /*! @brief a template for a bidirectional iterator for the @ref basic_json class This class implements a both iterators (iterator and const_iterator) for the @ref basic_json class. @note An iterator is called *initialized* when a pointer to a JSON value has been set (e.g., by a constructor or a copy assignment). If the iterator is default-constructed, it is *uninitialized* and most methods are undefined. **The library uses assertions to detect calls on uninitialized iterators.** @requirement The class satisfies the following concept requirements: - [BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): The iterator that can be moved can be moved in both directions (i.e. incremented and decremented). @since version 1.0.0, simplified in version 2.0.9, change to bidirectional iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593) */ template class iter_impl // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { /// the iterator with BasicJsonType of different const-ness using other_iter_impl = iter_impl::value, typename std::remove_const::type, const BasicJsonType>::type>; /// allow basic_json to access private members friend other_iter_impl; friend BasicJsonType; friend iteration_proxy; friend iteration_proxy_value; using object_t = typename BasicJsonType::object_t; using array_t = typename BasicJsonType::array_t; // make sure BasicJsonType is basic_json or const basic_json static_assert(is_basic_json::type>::value, "iter_impl only accepts (const) basic_json"); // superficial check for the LegacyBidirectionalIterator named requirement static_assert(std::is_base_of::value && std::is_base_of::iterator_category>::value, "basic_json iterator assumes array and object type iterators satisfy the LegacyBidirectionalIterator named requirement."); public: /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. /// The C++ Standard has never required user-defined iterators to derive from std::iterator. /// A user-defined iterator should provide publicly accessible typedefs named /// iterator_category, value_type, difference_type, pointer, and reference. /// Note that value_type is required to be non-const, even for constant iterators. using iterator_category = std::bidirectional_iterator_tag; /// the type of the values when the iterator is dereferenced using value_type = typename BasicJsonType::value_type; /// a type to represent differences between iterators using difference_type = typename BasicJsonType::difference_type; /// defines a pointer to the type iterated over (value_type) using pointer = typename std::conditional::value, typename BasicJsonType::const_pointer, typename BasicJsonType::pointer>::type; /// defines a reference to the type iterated over (value_type) using reference = typename std::conditional::value, typename BasicJsonType::const_reference, typename BasicJsonType::reference>::type; iter_impl() = default; ~iter_impl() = default; iter_impl(iter_impl&&) noexcept = default; iter_impl& operator=(iter_impl&&) noexcept = default; /*! @brief constructor for a given JSON instance @param[in] object pointer to a JSON object for this iterator @pre object != nullptr @post The iterator is initialized; i.e. `m_object != nullptr`. */ explicit iter_impl(pointer object) noexcept : m_object(object) { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { m_it.object_iterator = typename object_t::iterator(); break; } case value_t::array: { m_it.array_iterator = typename array_t::iterator(); break; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { m_it.primitive_iterator = primitive_iterator_t(); break; } } } /*! @note The conventional copy constructor and copy assignment are implicitly defined. Combined with the following converting constructor and assignment, they support: (1) copy from iterator to iterator, (2) copy from const iterator to const iterator, and (3) conversion from iterator to const iterator. However conversion from const iterator to iterator is not defined. */ /*! @brief const copy constructor @param[in] other const iterator to copy from @note This copy constructor had to be defined explicitly to circumvent a bug occurring on msvc v19.0 compiler (VS 2015) debug build. For more information refer to: https://github.com/nlohmann/json/issues/1608 */ iter_impl(const iter_impl& other) noexcept : m_object(other.m_object), m_it(other.m_it) {} /*! @brief converting assignment @param[in] other const iterator to copy from @return const/non-const iterator @note It is not checked whether @a other is initialized. */ iter_impl& operator=(const iter_impl& other) noexcept { if (&other != this) { m_object = other.m_object; m_it = other.m_it; } return *this; } /*! @brief converting constructor @param[in] other non-const iterator to copy from @note It is not checked whether @a other is initialized. */ iter_impl(const iter_impl::type>& other) noexcept : m_object(other.m_object), m_it(other.m_it) {} /*! @brief converting assignment @param[in] other non-const iterator to copy from @return const/non-const iterator @note It is not checked whether @a other is initialized. */ iter_impl& operator=(const iter_impl::type>& other) noexcept // NOLINT(cert-oop54-cpp) { m_object = other.m_object; m_it = other.m_it; return *this; } JSON_PRIVATE_UNLESS_TESTED: /*! @brief set the iterator to the first value @pre The iterator is initialized; i.e. `m_object != nullptr`. */ void set_begin() noexcept { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { m_it.object_iterator = m_object->m_data.m_value.object->begin(); break; } case value_t::array: { m_it.array_iterator = m_object->m_data.m_value.array->begin(); break; } case value_t::null: { // set to end so begin()==end() is true: null is empty m_it.primitive_iterator.set_end(); break; } case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { m_it.primitive_iterator.set_begin(); break; } } } /*! @brief set the iterator past the last value @pre The iterator is initialized; i.e. `m_object != nullptr`. */ void set_end() noexcept { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { m_it.object_iterator = m_object->m_data.m_value.object->end(); break; } case value_t::array: { m_it.array_iterator = m_object->m_data.m_value.array->end(); break; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { m_it.primitive_iterator.set_end(); break; } } } public: /*! @brief return a reference to the value pointed to by the iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference operator*() const { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { JSON_ASSERT(m_it.object_iterator != m_object->m_data.m_value.object->end()); return m_it.object_iterator->second; } case value_t::array: { JSON_ASSERT(m_it.array_iterator != m_object->m_data.m_value.array->end()); return *m_it.array_iterator; } case value_t::null: JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object)); case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin())) { return *m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object)); } } } /*! @brief dereference the iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ pointer operator->() const { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { JSON_ASSERT(m_it.object_iterator != m_object->m_data.m_value.object->end()); return &(m_it.object_iterator->second); } case value_t::array: { JSON_ASSERT(m_it.array_iterator != m_object->m_data.m_value.array->end()); return &*m_it.array_iterator; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin())) { return m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object)); } } } /*! @brief post-increment (it++) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator++(int)& // NOLINT(cert-dcl21-cpp) { auto result = *this; ++(*this); return result; } /*! @brief pre-increment (++it) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator++() { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { std::advance(m_it.object_iterator, 1); break; } case value_t::array: { std::advance(m_it.array_iterator, 1); break; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { ++m_it.primitive_iterator; break; } } return *this; } /*! @brief post-decrement (it--) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator--(int)& // NOLINT(cert-dcl21-cpp) { auto result = *this; --(*this); return result; } /*! @brief pre-decrement (--it) @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator--() { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: { std::advance(m_it.object_iterator, -1); break; } case value_t::array: { std::advance(m_it.array_iterator, -1); break; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { --m_it.primitive_iterator; break; } } return *this; } /*! @brief comparison: equal @pre (1) Both iterators are initialized to point to the same object, or (2) both iterators are value-initialized. */ template < typename IterImpl, detail::enable_if_t < (std::is_same::value || std::is_same::value), std::nullptr_t > = nullptr > bool operator==(const IterImpl& other) const { // if objects are not the same, the comparison is undefined if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) { JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers", m_object)); } // value-initialized forward iterators can be compared, and must compare equal to other value-initialized iterators of the same type #4493 if (m_object == nullptr) { return true; } switch (m_object->m_data.m_type) { case value_t::object: return (m_it.object_iterator == other.m_it.object_iterator); case value_t::array: return (m_it.array_iterator == other.m_it.array_iterator); case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: return (m_it.primitive_iterator == other.m_it.primitive_iterator); } } /*! @brief comparison: not equal @pre (1) Both iterators are initialized to point to the same object, or (2) both iterators are value-initialized. */ template < typename IterImpl, detail::enable_if_t < (std::is_same::value || std::is_same::value), std::nullptr_t > = nullptr > bool operator!=(const IterImpl& other) const { return !operator==(other); } /*! @brief comparison: smaller @pre (1) Both iterators are initialized to point to the same object, or (2) both iterators are value-initialized. */ bool operator<(const iter_impl& other) const { // if objects are not the same, the comparison is undefined if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) { JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers", m_object)); } // value-initialized forward iterators can be compared, and must compare equal to other value-initialized iterators of the same type #4493 if (m_object == nullptr) { // the iterators are both value-initialized and are to be considered equal, but this function checks for smaller, so we return false return false; } switch (m_object->m_data.m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators", m_object)); case value_t::array: return (m_it.array_iterator < other.m_it.array_iterator); case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: return (m_it.primitive_iterator < other.m_it.primitive_iterator); } } /*! @brief comparison: less than or equal @pre (1) Both iterators are initialized to point to the same object, or (2) both iterators are value-initialized. */ bool operator<=(const iter_impl& other) const { return !other.operator < (*this); } /*! @brief comparison: greater than @pre (1) Both iterators are initialized to point to the same object, or (2) both iterators are value-initialized. */ bool operator>(const iter_impl& other) const { return !operator<=(other); } /*! @brief comparison: greater than or equal @pre (1) The iterator is initialized; i.e. `m_object != nullptr`, or (2) both iterators are value-initialized. */ bool operator>=(const iter_impl& other) const { return !operator<(other); } /*! @brief add to iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator+=(difference_type i) { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators", m_object)); case value_t::array: { std::advance(m_it.array_iterator, i); break; } case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { m_it.primitive_iterator += i; break; } } return *this; } /*! @brief subtract from iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl& operator-=(difference_type i) { return operator+=(-i); } /*! @brief add to iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator+(difference_type i) const { auto result = *this; result += i; return result; } /*! @brief addition of distance and iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ friend iter_impl operator+(difference_type i, const iter_impl& it) { auto result = it; result += i; return result; } /*! @brief subtract from iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ iter_impl operator-(difference_type i) const { auto result = *this; result -= i; return result; } /*! @brief return difference @pre The iterator is initialized; i.e. `m_object != nullptr`. */ difference_type operator-(const iter_impl& other) const { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators", m_object)); case value_t::array: return m_it.array_iterator - other.m_it.array_iterator; case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: return m_it.primitive_iterator - other.m_it.primitive_iterator; } } /*! @brief access to successor @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference operator[](difference_type n) const { JSON_ASSERT(m_object != nullptr); switch (m_object->m_data.m_type) { case value_t::object: JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators", m_object)); case value_t::array: return *std::next(m_it.array_iterator, n); case value_t::null: JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object)); case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: { if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n)) { return *m_object; } JSON_THROW(invalid_iterator::create(214, "cannot get value", m_object)); } } } /*! @brief return the key of an object iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ const typename object_t::key_type& key() const { JSON_ASSERT(m_object != nullptr); if (JSON_HEDLEY_LIKELY(m_object->is_object())) { return m_it.object_iterator->first; } JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators", m_object)); } /*! @brief return the value of an iterator @pre The iterator is initialized; i.e. `m_object != nullptr`. */ reference value() const { return operator*(); } JSON_PRIVATE_UNLESS_TESTED: /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance internal_iterator::type> m_it {}; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/iteration_proxy.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // size_t #include // forward_iterator_tag #include // tuple_size, get, tuple_element #include // move #if JSON_HAS_RANGES #include // enable_borrowed_range #endif #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template class iteration_proxy_value { public: using difference_type = std::ptrdiff_t; using value_type = iteration_proxy_value; using pointer = value_type *; using reference = value_type &; using iterator_category = std::forward_iterator_tag; using string_type = typename std::remove_cv< typename std::remove_reference().key() ) >::type >::type; private: /// the iterator IteratorType anchor{}; /// an index for arrays (used to create key names) std::size_t array_index = 0; /// last stringified array index mutable std::size_t array_index_last = 0; /// a string representation of the array index mutable string_type array_index_str = "0"; /// an empty string (to return a reference for primitive values) string_type empty_str{}; public: explicit iteration_proxy_value() = default; explicit iteration_proxy_value(IteratorType it, std::size_t array_index_ = 0) noexcept(std::is_nothrow_move_constructible::value && std::is_nothrow_default_constructible::value) : anchor(std::move(it)) , array_index(array_index_) {} iteration_proxy_value(iteration_proxy_value const&) = default; iteration_proxy_value& operator=(iteration_proxy_value const&) = default; // older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions iteration_proxy_value(iteration_proxy_value&&) noexcept(std::is_nothrow_move_constructible::value && std::is_nothrow_move_constructible::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) iteration_proxy_value& operator=(iteration_proxy_value&&) noexcept(std::is_nothrow_move_assignable::value && std::is_nothrow_move_assignable::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) ~iteration_proxy_value() = default; /// dereference operator (needed for range-based for) const iteration_proxy_value& operator*() const { return *this; } /// increment operator (needed for range-based for) iteration_proxy_value& operator++() { ++anchor; ++array_index; return *this; } iteration_proxy_value operator++(int)& // NOLINT(cert-dcl21-cpp) { auto tmp = iteration_proxy_value(anchor, array_index); ++anchor; ++array_index; return tmp; } /// equality operator (needed for InputIterator) bool operator==(const iteration_proxy_value& o) const { return anchor == o.anchor; } /// inequality operator (needed for range-based for) bool operator!=(const iteration_proxy_value& o) const { return anchor != o.anchor; } /// return key of the iterator const string_type& key() const { JSON_ASSERT(anchor.m_object != nullptr); switch (anchor.m_object->type()) { // use integer array index as key case value_t::array: { if (array_index != array_index_last) { int_to_string( array_index_str, array_index ); array_index_last = array_index; } return array_index_str; } // use key from the object case value_t::object: return anchor.key(); // use an empty key for all primitive types case value_t::null: case value_t::string: case value_t::boolean: case value_t::number_integer: case value_t::number_unsigned: case value_t::number_float: case value_t::binary: case value_t::discarded: default: return empty_str; } } /// return value of the iterator typename IteratorType::reference value() const { return anchor.value(); } }; /// proxy class for the items() function template class iteration_proxy { private: /// the container to iterate typename IteratorType::pointer container = nullptr; public: explicit iteration_proxy() = default; /// construct iteration proxy from a container explicit iteration_proxy(typename IteratorType::reference cont) noexcept : container(&cont) {} iteration_proxy(iteration_proxy const&) = default; iteration_proxy& operator=(iteration_proxy const&) = default; iteration_proxy(iteration_proxy&&) noexcept = default; iteration_proxy& operator=(iteration_proxy&&) noexcept = default; ~iteration_proxy() = default; /// return iterator begin (needed for range-based for) iteration_proxy_value begin() const noexcept { return iteration_proxy_value(container->begin()); } /// return iterator end (needed for range-based for) iteration_proxy_value end() const noexcept { return iteration_proxy_value(container->end()); } }; // Structured Bindings Support // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 template = 0> auto get(const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.key()) { return i.key(); } // Structured Bindings Support // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 template = 0> auto get(const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.value()) { return i.value(); } } // namespace detail NLOHMANN_JSON_NAMESPACE_END // The Addition to the STD Namespace is required to add // Structured Bindings Support to the iteration_proxy_value class // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 namespace std { #if defined(__clang__) // Fix: https://github.com/nlohmann/json/issues/1401 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmismatched-tags" #endif template class tuple_size<::nlohmann::detail::iteration_proxy_value> // NOLINT(cert-dcl58-cpp) : public std::integral_constant {}; template class tuple_element> // NOLINT(cert-dcl58-cpp) { public: using type = decltype( get(std::declval < ::nlohmann::detail::iteration_proxy_value> ())); }; #if defined(__clang__) #pragma clang diagnostic pop #endif } // namespace std #if JSON_HAS_RANGES template inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy> = true; #endif ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/iterator_traits.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // random_access_iterator_tag #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template struct iterator_types {}; template struct iterator_types < It, void_t> { using difference_type = typename It::difference_type; using value_type = typename It::value_type; using pointer = typename It::pointer; using reference = typename It::reference; using iterator_category = typename It::iterator_category; }; // This is required as some compilers implement std::iterator_traits in a way that // doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. template struct iterator_traits { }; template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> : iterator_types { }; template struct iterator_traits::value>> { using iterator_category = std::random_access_iterator_tag; using value_type = T; using difference_type = ptrdiff_t; using pointer = T*; using reference = T&; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/json_reverse_iterator.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // ptrdiff_t #include // reverse_iterator #include // declval #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { ////////////////////// // reverse_iterator // ////////////////////// /*! @brief a template for a reverse iterator class @tparam Base the base iterator type to reverse. Valid types are @ref iterator (to create @ref reverse_iterator) and @ref const_iterator (to create @ref const_reverse_iterator). @requirement The class satisfies the following concept requirements: - [BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): The iterator that can be moved can be moved in both directions (i.e. incremented and decremented). - [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator): It is possible to write to the pointed-to element (only if @a Base is @ref iterator). @since version 1.0.0 */ template class json_reverse_iterator : public std::reverse_iterator { public: using difference_type = std::ptrdiff_t; /// shortcut to the reverse iterator adapter using base_iterator = std::reverse_iterator; /// the reference type for the pointed-to element using reference = typename Base::reference; /// create reverse iterator from iterator explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept : base_iterator(it) {} /// create reverse iterator from base class explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {} /// post-increment (it++) json_reverse_iterator operator++(int)& // NOLINT(cert-dcl21-cpp) { return static_cast(base_iterator::operator++(1)); } /// pre-increment (++it) json_reverse_iterator& operator++() { return static_cast(base_iterator::operator++()); } /// post-decrement (it--) json_reverse_iterator operator--(int)& // NOLINT(cert-dcl21-cpp) { return static_cast(base_iterator::operator--(1)); } /// pre-decrement (--it) json_reverse_iterator& operator--() { return static_cast(base_iterator::operator--()); } /// add to iterator json_reverse_iterator& operator+=(difference_type i) { return static_cast(base_iterator::operator+=(i)); } /// add to iterator json_reverse_iterator operator+(difference_type i) const { return static_cast(base_iterator::operator+(i)); } /// subtract from iterator json_reverse_iterator operator-(difference_type i) const { return static_cast(base_iterator::operator-(i)); } /// return difference difference_type operator-(const json_reverse_iterator& other) const { return base_iterator(*this) - base_iterator(other); } /// access to successor reference operator[](difference_type n) const { return *(this->operator+(n)); } /// return the key of an object iterator auto key() const -> decltype(std::declval().key()) { auto it = --this->base(); return it.key(); } /// return the value of an iterator reference value() const { auto it = --this->base(); return it.operator * (); } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/iterators/primitive_iterator.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // ptrdiff_t #include // numeric_limits #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /* @brief an iterator for primitive JSON types This class models an iterator for primitive JSON types (boolean, number, string). It's only purpose is to allow the iterator/const_iterator classes to "iterate" over primitive values. Internally, the iterator is modeled by a `difference_type` variable. Value begin_value (`0`) models the begin, end_value (`1`) models past the end. */ class primitive_iterator_t { private: using difference_type = std::ptrdiff_t; static constexpr difference_type begin_value = 0; static constexpr difference_type end_value = begin_value + 1; JSON_PRIVATE_UNLESS_TESTED: /// iterator as signed integer type difference_type m_it = (std::numeric_limits::min)(); public: constexpr difference_type get_value() const noexcept { return m_it; } /// set iterator to a defined beginning void set_begin() noexcept { m_it = begin_value; } /// set iterator to a defined past the end void set_end() noexcept { m_it = end_value; } /// return whether the iterator can be dereferenced constexpr bool is_begin() const noexcept { return m_it == begin_value; } /// return whether the iterator is at end constexpr bool is_end() const noexcept { return m_it == end_value; } friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it == rhs.m_it; } friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it < rhs.m_it; } primitive_iterator_t operator+(difference_type n) noexcept { auto result = *this; result += n; return result; } friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept { return lhs.m_it - rhs.m_it; } primitive_iterator_t& operator++() noexcept { ++m_it; return *this; } primitive_iterator_t operator++(int)& noexcept // NOLINT(cert-dcl21-cpp) { auto result = *this; ++m_it; return result; } primitive_iterator_t& operator--() noexcept { --m_it; return *this; } primitive_iterator_t operator--(int)& noexcept // NOLINT(cert-dcl21-cpp) { auto result = *this; --m_it; return result; } primitive_iterator_t& operator+=(difference_type n) noexcept { m_it += n; return *this; } primitive_iterator_t& operator-=(difference_type n) noexcept { m_it -= n; return *this; } }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/json_custom_base_class.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // conditional, is_same #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { /*! @brief Default base class of the @ref basic_json class. So that the correct implementations of the copy / move ctors / assign operators of @ref basic_json do not require complex case distinctions (no base class / custom base class used as customization point), @ref basic_json always has a base class. By default, this class is used because it is empty and thus has no effect on the behavior of @ref basic_json. */ struct json_default_base {}; template using json_base_class = typename std::conditional < std::is_same::value, json_default_base, T >::type; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/json_pointer.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // all_of #include // isdigit #include // errno, ERANGE #include // strtoull #ifndef JSON_NO_IO #include // ostream #endif // JSON_NO_IO #include // max #include // accumulate #include // string #include // move #include // vector #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ template class json_pointer { // allow basic_json to access private members NLOHMANN_BASIC_JSON_TPL_DECLARATION friend class basic_json; template friend class json_pointer; template struct string_t_helper { using type = T; }; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct string_t_helper { using type = StringType; }; public: // for backwards compatibility accept BasicJsonType using string_t = typename string_t_helper::type; /// @brief create JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/json_pointer/ explicit json_pointer(const string_t& s = "") : reference_tokens(split(s)) {} /// @brief return a string representation of the JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/to_string/ string_t to_string() const { return std::accumulate(reference_tokens.begin(), reference_tokens.end(), string_t{}, [](const string_t& a, const string_t& b) { return detail::concat(a, '/', detail::escape(b)); }); } /// @brief return a string representation of the JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_string/ JSON_HEDLEY_DEPRECATED_FOR(3.11.0, to_string()) operator string_t() const { return to_string(); } #ifndef JSON_NO_IO /// @brief write string representation of the JSON pointer to stream /// @sa https://json.nlohmann.me/api/basic_json/operator_ltlt/ friend std::ostream& operator<<(std::ostream& o, const json_pointer& ptr) { o << ptr.to_string(); return o; } #endif /// @brief append another JSON pointer at the end of this JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/ json_pointer& operator/=(const json_pointer& ptr) { reference_tokens.insert(reference_tokens.end(), ptr.reference_tokens.begin(), ptr.reference_tokens.end()); return *this; } /// @brief append an unescaped reference token at the end of this JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/ json_pointer& operator/=(string_t token) { push_back(std::move(token)); return *this; } /// @brief append an array index at the end of this JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slasheq/ json_pointer& operator/=(std::size_t array_idx) { return *this /= std::to_string(array_idx); } /// @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/ friend json_pointer operator/(const json_pointer& lhs, const json_pointer& rhs) { return json_pointer(lhs) /= rhs; } /// @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/ friend json_pointer operator/(const json_pointer& lhs, string_t token) // NOLINT(performance-unnecessary-value-param) { return json_pointer(lhs) /= std::move(token); } /// @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/operator_slash/ friend json_pointer operator/(const json_pointer& lhs, std::size_t array_idx) { return json_pointer(lhs) /= array_idx; } /// @brief returns the parent of this JSON pointer /// @sa https://json.nlohmann.me/api/json_pointer/parent_pointer/ json_pointer parent_pointer() const { if (empty()) { return *this; } json_pointer res = *this; res.pop_back(); return res; } /// @brief remove last reference token /// @sa https://json.nlohmann.me/api/json_pointer/pop_back/ void pop_back() { if (JSON_HEDLEY_UNLIKELY(empty())) { JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent", nullptr)); } reference_tokens.pop_back(); } /// @brief return last reference token /// @sa https://json.nlohmann.me/api/json_pointer/back/ const string_t& back() const { if (JSON_HEDLEY_UNLIKELY(empty())) { JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent", nullptr)); } return reference_tokens.back(); } /// @brief append an unescaped token at the end of the reference pointer /// @sa https://json.nlohmann.me/api/json_pointer/push_back/ void push_back(const string_t& token) { reference_tokens.push_back(token); } /// @brief append an unescaped token at the end of the reference pointer /// @sa https://json.nlohmann.me/api/json_pointer/push_back/ void push_back(string_t&& token) { reference_tokens.push_back(std::move(token)); } /// @brief return whether pointer points to the root document /// @sa https://json.nlohmann.me/api/json_pointer/empty/ bool empty() const noexcept { return reference_tokens.empty(); } private: /*! @param[in] s reference token to be converted into an array index @return integer representation of @a s @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index begins not with a digit @throw out_of_range.404 if string @a s could not be converted to an integer @throw out_of_range.410 if an array index exceeds size_type */ template static typename BasicJsonType::size_type array_index(const string_t& s) { using size_type = typename BasicJsonType::size_type; // error condition (cf. RFC 6901, Sect. 4) if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && s[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, detail::concat("array index '", s, "' must not begin with '0'"), nullptr)); } // error condition (cf. RFC 6901, Sect. 4) if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && !(s[0] >= '1' && s[0] <= '9'))) { JSON_THROW(detail::parse_error::create(109, 0, detail::concat("array index '", s, "' is not a number"), nullptr)); } const char* p = s.c_str(); char* p_end = nullptr; errno = 0; // strtoull doesn't reset errno const unsigned long long res = std::strtoull(p, &p_end, 10); // NOLINT(runtime/int) if (p == p_end // invalid input or empty string || errno == ERANGE // out of range || JSON_HEDLEY_UNLIKELY(static_cast(p_end - p) != s.size())) // incomplete read { JSON_THROW(detail::out_of_range::create(404, detail::concat("unresolved reference token '", s, "'"), nullptr)); } // only triggered on special platforms (like 32bit), see also // https://github.com/nlohmann/json/pull/2203 if (res >= static_cast((std::numeric_limits::max)())) // NOLINT(runtime/int) { JSON_THROW(detail::out_of_range::create(410, detail::concat("array index ", s, " exceeds size_type"), nullptr)); // LCOV_EXCL_LINE } return static_cast(res); } JSON_PRIVATE_UNLESS_TESTED: json_pointer top() const { if (JSON_HEDLEY_UNLIKELY(empty())) { JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent", nullptr)); } json_pointer result = *this; result.reference_tokens = {reference_tokens[0]}; return result; } private: /*! @brief create and return a reference to the pointed to value @complexity Linear in the number of reference tokens. @throw parse_error.109 if array index is not a number @throw type_error.313 if value cannot be unflattened */ template BasicJsonType& get_and_create(BasicJsonType& j) const { auto* result = &j; // in case no reference tokens exist, return a reference to the JSON value // j which will be overwritten by a primitive value for (const auto& reference_token : reference_tokens) { switch (result->type()) { case detail::value_t::null: { if (reference_token == "0") { // start a new array if reference token is 0 result = &result->operator[](0); } else { // start a new object otherwise result = &result->operator[](reference_token); } break; } case detail::value_t::object: { // create an entry in the object result = &result->operator[](reference_token); break; } case detail::value_t::array: { // create an entry in the array result = &result->operator[](array_index(reference_token)); break; } /* The following code is only reached if there exists a reference token _and_ the current value is primitive. In this case, we have an error situation, because primitive values may only occur as single value; that is, with an empty list of reference tokens. */ case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: JSON_THROW(detail::type_error::create(313, "invalid value to unflatten", &j)); } } return *result; } /*! @brief return a reference to the pointed to value @note This version does not throw if a value is not present, but tries to create nested values instead. For instance, calling this function with pointer `"/this/that"` on a null value is equivalent to calling `operator[]("this").operator[]("that")` on that value, effectively changing the null value to an object. @param[in] ptr a JSON value @return reference to the JSON value pointed to by the JSON pointer @complexity Linear in the length of the JSON pointer. @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.404 if the JSON pointer can not be resolved */ template BasicJsonType& get_unchecked(BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { // convert null values to arrays or objects before continuing if (ptr->is_null()) { // check if reference token is a number const bool nums = std::all_of(reference_token.begin(), reference_token.end(), [](const unsigned char x) { return std::isdigit(x); }); // change value to array for numbers or "-" or to object otherwise *ptr = (nums || reference_token == "-") ? detail::value_t::array : detail::value_t::object; } switch (ptr->type()) { case detail::value_t::object: { // use unchecked object access ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { if (reference_token == "-") { // explicitly treat "-" as index beyond the end ptr = &ptr->operator[](ptr->m_data.m_value.array->size()); } else { // convert array index to number; unchecked access ptr = &ptr->operator[](array_index(reference_token)); } break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: JSON_THROW(detail::out_of_range::create(404, detail::concat("unresolved reference token '", reference_token, "'"), ptr)); } } return *ptr; } /*! @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ template BasicJsonType& get_checked(BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { switch (ptr->type()) { case detail::value_t::object: { // note: at performs range check ptr = &ptr->at(reference_token); break; } case detail::value_t::array: { if (JSON_HEDLEY_UNLIKELY(reference_token == "-")) { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, detail::concat( "array index '-' (", std::to_string(ptr->m_data.m_value.array->size()), ") is out of range"), ptr)); } // note: at performs range check ptr = &ptr->at(array_index(reference_token)); break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: JSON_THROW(detail::out_of_range::create(404, detail::concat("unresolved reference token '", reference_token, "'"), ptr)); } } return *ptr; } /*! @brief return a const reference to the pointed to value @param[in] ptr a JSON value @return const reference to the JSON value pointed to by the JSON pointer @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ template const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { switch (ptr->type()) { case detail::value_t::object: { // use unchecked object access ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { if (JSON_HEDLEY_UNLIKELY(reference_token == "-")) { // "-" cannot be used for const access JSON_THROW(detail::out_of_range::create(402, detail::concat("array index '-' (", std::to_string(ptr->m_data.m_value.array->size()), ") is out of range"), ptr)); } // use unchecked array access ptr = &ptr->operator[](array_index(reference_token)); break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: JSON_THROW(detail::out_of_range::create(404, detail::concat("unresolved reference token '", reference_token, "'"), ptr)); } } return *ptr; } /*! @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number @throw out_of_range.402 if the array index '-' is used @throw out_of_range.404 if the JSON pointer can not be resolved */ template const BasicJsonType& get_checked(const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { switch (ptr->type()) { case detail::value_t::object: { // note: at performs range check ptr = &ptr->at(reference_token); break; } case detail::value_t::array: { if (JSON_HEDLEY_UNLIKELY(reference_token == "-")) { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, detail::concat( "array index '-' (", std::to_string(ptr->m_data.m_value.array->size()), ") is out of range"), ptr)); } // note: at performs range check ptr = &ptr->at(array_index(reference_token)); break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: JSON_THROW(detail::out_of_range::create(404, detail::concat("unresolved reference token '", reference_token, "'"), ptr)); } } return *ptr; } /*! @throw parse_error.106 if an array index begins with '0' @throw parse_error.109 if an array index was not a number */ template bool contains(const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { switch (ptr->type()) { case detail::value_t::object: { if (!ptr->contains(reference_token)) { // we did not find the key in the object return false; } ptr = &ptr->operator[](reference_token); break; } case detail::value_t::array: { if (JSON_HEDLEY_UNLIKELY(reference_token == "-")) { // "-" always fails the range check return false; } if (JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !("0" <= reference_token && reference_token <= "9"))) { // invalid char return false; } if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1)) { if (JSON_HEDLEY_UNLIKELY(!('1' <= reference_token[0] && reference_token[0] <= '9'))) { // first char should be between '1' and '9' return false; } for (std::size_t i = 1; i < reference_token.size(); i++) { if (JSON_HEDLEY_UNLIKELY(!('0' <= reference_token[i] && reference_token[i] <= '9'))) { // other char should be between '0' and '9' return false; } } } const auto idx = array_index(reference_token); if (idx >= ptr->size()) { // index out of range return false; } ptr = &ptr->operator[](idx); break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: { // we do not expect primitive values if there is still a // reference token to process return false; } } } // no reference token left means we found a primitive value return true; } /*! @brief split the string input to reference tokens @note This function is only called by the json_pointer constructor. All exceptions below are documented there. @throw parse_error.107 if the pointer is not empty or begins with '/' @throw parse_error.108 if character '~' is not followed by '0' or '1' */ static std::vector split(const string_t& reference_string) { std::vector result; // special case: empty reference string -> no reference tokens if (reference_string.empty()) { return result; } // check if nonempty reference string begins with slash if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/')) { JSON_THROW(detail::parse_error::create(107, 1, detail::concat("JSON pointer must be empty or begin with '/' - was: '", reference_string, "'"), nullptr)); } // extract the reference tokens: // - slash: position of the last read slash (or end of string) // - start: position after the previous slash for ( // search for the first slash after the first character std::size_t slash = reference_string.find_first_of('/', 1), // set the beginning of the first reference token start = 1; // we can stop if start == 0 (if slash == string_t::npos) start != 0; // set the beginning of the next reference token // (will eventually be 0 if slash == string_t::npos) start = (slash == string_t::npos) ? 0 : slash + 1, // find next slash slash = reference_string.find_first_of('/', start)) { // use the text between the beginning of the reference token // (start) and the last slash (slash). auto reference_token = reference_string.substr(start, slash - start); // check reference tokens are properly escaped for (std::size_t pos = reference_token.find_first_of('~'); pos != string_t::npos; pos = reference_token.find_first_of('~', pos + 1)) { JSON_ASSERT(reference_token[pos] == '~'); // ~ must be followed by 0 or 1 if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 || (reference_token[pos + 1] != '0' && reference_token[pos + 1] != '1'))) { JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'", nullptr)); } } // finally, store the reference token detail::unescape(reference_token); result.push_back(reference_token); } return result; } private: /*! @param[in] reference_string the reference string to the current value @param[in] value the value to consider @param[in,out] result the result object to insert values to @note Empty objects or arrays are flattened to `null`. */ template static void flatten(const string_t& reference_string, const BasicJsonType& value, BasicJsonType& result) { switch (value.type()) { case detail::value_t::array: { if (value.m_data.m_value.array->empty()) { // flatten empty array as null result[reference_string] = nullptr; } else { // iterate array and use index as reference string for (std::size_t i = 0; i < value.m_data.m_value.array->size(); ++i) { flatten(detail::concat(reference_string, '/', std::to_string(i)), value.m_data.m_value.array->operator[](i), result); } } break; } case detail::value_t::object: { if (value.m_data.m_value.object->empty()) { // flatten empty object as null result[reference_string] = nullptr; } else { // iterate object and use keys as reference string for (const auto& element : *value.m_data.m_value.object) { flatten(detail::concat(reference_string, '/', detail::escape(element.first)), element.second, result); } } break; } case detail::value_t::null: case detail::value_t::string: case detail::value_t::boolean: case detail::value_t::number_integer: case detail::value_t::number_unsigned: case detail::value_t::number_float: case detail::value_t::binary: case detail::value_t::discarded: default: { // add primitive value with its reference string result[reference_string] = value; break; } } } /*! @param[in] value flattened JSON @return unflattened JSON @throw parse_error.109 if array index is not a number @throw type_error.314 if value is not an object @throw type_error.315 if object values are not primitive @throw type_error.313 if value cannot be unflattened */ template static BasicJsonType unflatten(const BasicJsonType& value) { if (JSON_HEDLEY_UNLIKELY(!value.is_object())) { JSON_THROW(detail::type_error::create(314, "only objects can be unflattened", &value)); } BasicJsonType result; // iterate the JSON object values for (const auto& element : *value.m_data.m_value.object) { if (JSON_HEDLEY_UNLIKELY(!element.second.is_primitive())) { JSON_THROW(detail::type_error::create(315, "values in object must be primitive", &element.second)); } // assign value to reference pointed to by JSON pointer; Note that if // the JSON pointer is "" (i.e., points to the whole value), function // get_and_create returns a reference to result itself. An assignment // will then create a primitive value. json_pointer(element.first).get_and_create(result) = element.second; } return result; } // can't use conversion operator because of ambiguity json_pointer convert() const& { json_pointer result; result.reference_tokens = reference_tokens; return result; } json_pointer convert()&& { json_pointer result; result.reference_tokens = std::move(reference_tokens); return result; } public: #if JSON_HAS_THREE_WAY_COMPARISON /// @brief compares two JSON pointers for equality /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/ template bool operator==(const json_pointer& rhs) const noexcept { return reference_tokens == rhs.reference_tokens; } /// @brief compares JSON pointer and string for equality /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/ JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer)) bool operator==(const string_t& rhs) const { return *this == json_pointer(rhs); } /// @brief 3-way compares two JSON pointers template std::strong_ordering operator<=>(const json_pointer& rhs) const noexcept // *NOPAD* { return reference_tokens <=> rhs.reference_tokens; // *NOPAD* } #else /// @brief compares two JSON pointers for equality /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator==(const json_pointer& lhs, const json_pointer& rhs) noexcept; /// @brief compares JSON pointer and string for equality /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator==(const json_pointer& lhs, const StringType& rhs); /// @brief compares string and JSON pointer for equality /// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator==(const StringType& lhs, const json_pointer& rhs); /// @brief compares two JSON pointers for inequality /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator!=(const json_pointer& lhs, const json_pointer& rhs) noexcept; /// @brief compares JSON pointer and string for inequality /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator!=(const json_pointer& lhs, const StringType& rhs); /// @brief compares string and JSON pointer for inequality /// @sa https://json.nlohmann.me/api/json_pointer/operator_ne/ template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator!=(const StringType& lhs, const json_pointer& rhs); /// @brief compares two JSON pointer for less-than template // NOLINTNEXTLINE(readability-redundant-declaration) friend bool operator<(const json_pointer& lhs, const json_pointer& rhs) noexcept; #endif private: /// the reference tokens std::vector reference_tokens; }; #if !JSON_HAS_THREE_WAY_COMPARISON // functions cannot be defined inside class due to ODR violations template inline bool operator==(const json_pointer& lhs, const json_pointer& rhs) noexcept { return lhs.reference_tokens == rhs.reference_tokens; } template::string_t> JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer)) inline bool operator==(const json_pointer& lhs, const StringType& rhs) { return lhs == json_pointer(rhs); } template::string_t> JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer)) inline bool operator==(const StringType& lhs, const json_pointer& rhs) { return json_pointer(lhs) == rhs; } template inline bool operator!=(const json_pointer& lhs, const json_pointer& rhs) noexcept { return !(lhs == rhs); } template::string_t> JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer)) inline bool operator!=(const json_pointer& lhs, const StringType& rhs) { return !(lhs == rhs); } template::string_t> JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer)) inline bool operator!=(const StringType& lhs, const json_pointer& rhs) { return !(lhs == rhs); } template inline bool operator<(const json_pointer& lhs, const json_pointer& rhs) noexcept { return lhs.reference_tokens < rhs.reference_tokens; } #endif NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/json_ref.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template class json_ref { public: using value_type = BasicJsonType; json_ref(value_type&& value) : owned_value(std::move(value)) {} json_ref(const value_type& value) : value_ref(&value) {} json_ref(std::initializer_list init) : owned_value(init) {} template < class... Args, enable_if_t::value, int> = 0 > json_ref(Args && ... args) : owned_value(std::forward(args)...) {} // class should be movable only json_ref(json_ref&&) noexcept = default; json_ref(const json_ref&) = delete; json_ref& operator=(const json_ref&) = delete; json_ref& operator=(json_ref&&) = delete; ~json_ref() = default; value_type moved_or_copied() const { if (value_ref == nullptr) { return std::move(owned_value); } return *value_ref; } value_type const& operator*() const { return value_ref ? *value_ref : owned_value; } value_type const* operator->() const { return &** this; } private: mutable value_type owned_value = nullptr; value_type const* value_ref = nullptr; }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/macro_scope.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // declval, pair #include #include // This file contains all internal macro definitions (except those affecting ABI) // You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them #include // exclude unsupported compilers #if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif #endif // C++ language standard detection // if the user manually specified the used c++ version this is skipped #if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) #define JSON_HAS_CPP_20 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) #define JSON_HAS_CPP_14 #endif // the cpp 11 flag is always specified because it is the minimal required version #define JSON_HAS_CPP_11 #endif #ifdef __has_include #if __has_include() #include #endif #endif #if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) #ifdef JSON_HAS_CPP_17 #if defined(__cpp_lib_filesystem) #define JSON_HAS_FILESYSTEM 1 #elif defined(__cpp_lib_experimental_filesystem) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif !defined(__has_include) #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_FILESYSTEM 1 #elif __has_include() #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 #endif // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support #if defined(__clang_major__) && __clang_major__ < 7 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support #if defined(_MSC_VER) && _MSC_VER < 1914 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before iOS 13 #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif // no filesystem support before macOS Catalina #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #endif #endif #endif #ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 #endif #ifndef JSON_HAS_FILESYSTEM #define JSON_HAS_FILESYSTEM 0 #endif #ifndef JSON_HAS_THREE_WAY_COMPARISON #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L #define JSON_HAS_THREE_WAY_COMPARISON 1 #else #define JSON_HAS_THREE_WAY_COMPARISON 0 #endif #endif #ifndef JSON_HAS_RANGES // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 #define JSON_HAS_RANGES 0 #elif defined(__cpp_lib_ranges) #define JSON_HAS_RANGES 1 #else #define JSON_HAS_RANGES 0 #endif #endif #ifndef JSON_HAS_STATIC_RTTI #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 #define JSON_HAS_STATIC_RTTI 1 #else #define JSON_HAS_STATIC_RTTI 0 #endif #endif #ifdef JSON_HAS_CPP_17 #define JSON_INLINE_VARIABLE inline #else #define JSON_INLINE_VARIABLE #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] #else #define JSON_NO_UNIQUE_ADDRESS #endif // disable documentation warnings on clang #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdocumentation" #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" #endif // allow disabling exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try #define JSON_CATCH(exception) catch(exception) #define JSON_INTERNAL_CATCH(exception) catch(exception) #else #include #define JSON_THROW(exception) std::abort() #define JSON_TRY if(true) #define JSON_CATCH(exception) if(false) #define JSON_INTERNAL_CATCH(exception) if(false) #endif // override exception macros #if defined(JSON_THROW_USER) #undef JSON_THROW #define JSON_THROW JSON_THROW_USER #endif #if defined(JSON_TRY_USER) #undef JSON_TRY #define JSON_TRY JSON_TRY_USER #endif #if defined(JSON_CATCH_USER) #undef JSON_CATCH #define JSON_CATCH JSON_CATCH_USER #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_CATCH_USER #endif #if defined(JSON_INTERNAL_CATCH_USER) #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER #endif // allow overriding assert #if !defined(JSON_ASSERT) #include // assert #define JSON_ASSERT(x) assert(x) #endif // allow to access some private functions (needed by the test suite) #if defined(JSON_TESTS_PRIVATE) #define JSON_PRIVATE_UNLESS_TESTED public #else #define JSON_PRIVATE_UNLESS_TESTED private #endif /*! @brief macro to briefly define a mapping between an enum and JSON @def NLOHMANN_JSON_SERIALIZE_ENUM @since version 3.4.0 */ #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ template \ inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ { \ /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [e](const std::pair& ej_pair) -> bool \ { \ return ej_pair.first == e; \ }); \ j = ((it != std::end(m)) ? it : std::begin(m))->second; \ } \ template \ inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ { \ /* NOLINTNEXTLINE(modernize-type-traits) we use C++11 */ \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ /* NOLINTNEXTLINE(modernize-avoid-c-arrays) we don't want to depend on */ \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ [&j](const std::pair& ej_pair) -> bool \ { \ return ej_pair.second == j; \ }); \ e = ((it != std::end(m)) ? it : std::begin(m))->first; \ } // Ugly macros to avoid uglier copy-paste when specializing basic_json. They // may be removed in the future once the class is split. #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ template class ObjectType, \ template class ArrayType, \ class StringType, class BooleanType, class NumberIntegerType, \ class NumberUnsignedType, class NumberFloatType, \ template class AllocatorType, \ template class JSONSerializer, \ class BinaryType, \ class CustomBaseClass> #define NLOHMANN_BASIC_JSON_TPL \ basic_json // Macros to simplify conversion from/to types #define NLOHMANN_JSON_EXPAND( x ) x #define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ NLOHMANN_JSON_PASTE64, \ NLOHMANN_JSON_PASTE63, \ NLOHMANN_JSON_PASTE62, \ NLOHMANN_JSON_PASTE61, \ NLOHMANN_JSON_PASTE60, \ NLOHMANN_JSON_PASTE59, \ NLOHMANN_JSON_PASTE58, \ NLOHMANN_JSON_PASTE57, \ NLOHMANN_JSON_PASTE56, \ NLOHMANN_JSON_PASTE55, \ NLOHMANN_JSON_PASTE54, \ NLOHMANN_JSON_PASTE53, \ NLOHMANN_JSON_PASTE52, \ NLOHMANN_JSON_PASTE51, \ NLOHMANN_JSON_PASTE50, \ NLOHMANN_JSON_PASTE49, \ NLOHMANN_JSON_PASTE48, \ NLOHMANN_JSON_PASTE47, \ NLOHMANN_JSON_PASTE46, \ NLOHMANN_JSON_PASTE45, \ NLOHMANN_JSON_PASTE44, \ NLOHMANN_JSON_PASTE43, \ NLOHMANN_JSON_PASTE42, \ NLOHMANN_JSON_PASTE41, \ NLOHMANN_JSON_PASTE40, \ NLOHMANN_JSON_PASTE39, \ NLOHMANN_JSON_PASTE38, \ NLOHMANN_JSON_PASTE37, \ NLOHMANN_JSON_PASTE36, \ NLOHMANN_JSON_PASTE35, \ NLOHMANN_JSON_PASTE34, \ NLOHMANN_JSON_PASTE33, \ NLOHMANN_JSON_PASTE32, \ NLOHMANN_JSON_PASTE31, \ NLOHMANN_JSON_PASTE30, \ NLOHMANN_JSON_PASTE29, \ NLOHMANN_JSON_PASTE28, \ NLOHMANN_JSON_PASTE27, \ NLOHMANN_JSON_PASTE26, \ NLOHMANN_JSON_PASTE25, \ NLOHMANN_JSON_PASTE24, \ NLOHMANN_JSON_PASTE23, \ NLOHMANN_JSON_PASTE22, \ NLOHMANN_JSON_PASTE21, \ NLOHMANN_JSON_PASTE20, \ NLOHMANN_JSON_PASTE19, \ NLOHMANN_JSON_PASTE18, \ NLOHMANN_JSON_PASTE17, \ NLOHMANN_JSON_PASTE16, \ NLOHMANN_JSON_PASTE15, \ NLOHMANN_JSON_PASTE14, \ NLOHMANN_JSON_PASTE13, \ NLOHMANN_JSON_PASTE12, \ NLOHMANN_JSON_PASTE11, \ NLOHMANN_JSON_PASTE10, \ NLOHMANN_JSON_PASTE9, \ NLOHMANN_JSON_PASTE8, \ NLOHMANN_JSON_PASTE7, \ NLOHMANN_JSON_PASTE6, \ NLOHMANN_JSON_PASTE5, \ NLOHMANN_JSON_PASTE4, \ NLOHMANN_JSON_PASTE3, \ NLOHMANN_JSON_PASTE2, \ NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) #define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) #define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) #define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) #define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) #define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) #define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) #define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) #define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) #define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) #define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) #define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) #define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) #define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) #define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) #define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) #define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) #define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) #define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) #define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) #define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) #define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) #define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) #define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) #define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) #define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) #define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) #define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) #define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) #define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) #define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) #define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) #define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) #define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) #define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) #define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) #define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) #define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) #define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) #define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) #define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) #define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) #define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) #define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) #define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) #define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) #define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) #define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) #define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) #define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) #define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) #define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) #define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) #define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) #define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) #define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) #define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) #define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) #define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) #define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); #define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = !nlohmann_json_j.is_null() ? nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1) : nlohmann_json_default_obj.v1; /*! @brief macro @def NLOHMANN_DEFINE_TYPE_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT @since version 3.11.0 */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE @since version 3.11.x */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE @since version 3.9.0 */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT @since version 3.11.0 */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE @since version 3.11.x */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE @since version 3.11.x */ #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE(Type, BaseType, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } #define NLOHMANN_DEFINE_DERIVED_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ /*! @brief macro @def NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE @since version 3.11.x */ #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE(Type, BaseType, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, BaseType, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { nlohmann::from_json(nlohmann_json_j, static_cast(nlohmann_json_t)); const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } #define NLOHMANN_DEFINE_DERIVED_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, BaseType, ...) \ inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { nlohmann::to_json(nlohmann_json_j, static_cast(nlohmann_json_t)); NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ // inspired from https://stackoverflow.com/a/26745591 // allows to call any std function as if (e.g. with begin): // using std::begin; begin(x); // // it allows using the detected idiom to retrieve the return type // of such an expression #define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ namespace detail { \ using std::std_name; \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ } \ \ namespace detail2 { \ struct std_name##_tag \ { \ }; \ \ template \ std_name##_tag std_name(T&&...); \ \ template \ using result_of_##std_name = decltype(std_name(std::declval()...)); \ \ template \ struct would_call_std_##std_name \ { \ static constexpr auto const value = ::nlohmann::detail:: \ is_detected_exact::value; \ }; \ } /* namespace detail2 */ \ \ template \ struct would_call_std_##std_name : detail2::would_call_std_##std_name \ { \ } #ifndef JSON_USE_IMPLICIT_CONVERSIONS #define JSON_USE_IMPLICIT_CONVERSIONS 1 #endif #if JSON_USE_IMPLICIT_CONVERSIONS #define JSON_EXPLICIT #else #define JSON_EXPLICIT explicit #endif #ifndef JSON_DISABLE_ENUM_SERIALIZATION #define JSON_DISABLE_ENUM_SERIALIZATION 0 #endif #ifndef JSON_USE_GLOBAL_UDLS #define JSON_USE_GLOBAL_UDLS 1 #endif ================================================ FILE: Game Trainers/common/include/nlohmann/detail/macro_unscope.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once // restore clang diagnostic settings #if defined(__clang__) #pragma clang diagnostic pop #endif // clean up #undef JSON_ASSERT #undef JSON_INTERNAL_CATCH #undef JSON_THROW #undef JSON_PRIVATE_UNLESS_TESTED #undef NLOHMANN_BASIC_JSON_TPL_DECLARATION #undef NLOHMANN_BASIC_JSON_TPL #undef JSON_EXPLICIT #undef NLOHMANN_CAN_CALL_STD_FUNC_IMPL #undef JSON_INLINE_VARIABLE #undef JSON_NO_UNIQUE_ADDRESS #undef JSON_DISABLE_ENUM_SERIALIZATION #undef JSON_USE_GLOBAL_UDLS #ifndef JSON_TEST_KEEP_MACROS #undef JSON_CATCH #undef JSON_TRY #undef JSON_HAS_CPP_11 #undef JSON_HAS_CPP_14 #undef JSON_HAS_CPP_17 #undef JSON_HAS_CPP_20 #undef JSON_HAS_FILESYSTEM #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM #undef JSON_HAS_THREE_WAY_COMPARISON #undef JSON_HAS_RANGES #undef JSON_HAS_STATIC_RTTI #undef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON #endif #include ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/call_std/begin.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/call_std/end.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/cpp_future.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-FileCopyrightText: 2018 The Abseil Authors // SPDX-License-Identifier: MIT #pragma once #include // array #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type #include // index_sequence, make_index_sequence, index_sequence_for #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template using uncvref_t = typename std::remove_cv::type>::type; #ifdef JSON_HAS_CPP_14 // the following utilities are natively available in C++14 using std::enable_if_t; using std::index_sequence; using std::make_index_sequence; using std::index_sequence_for; #else // alias templates to reduce boilerplate template using enable_if_t = typename std::enable_if::type; // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. //// START OF CODE FROM GOOGLE ABSEIL // integer_sequence // // Class template representing a compile-time integer sequence. An instantiation // of `integer_sequence` has a sequence of integers encoded in its // type through its template arguments (which is a common need when // working with C++11 variadic templates). `absl::integer_sequence` is designed // to be a drop-in replacement for C++14's `std::integer_sequence`. // // Example: // // template< class T, T... Ints > // void user_function(integer_sequence); // // int main() // { // // user_function's `T` will be deduced to `int` and `Ints...` // // will be deduced to `0, 1, 2, 3, 4`. // user_function(make_integer_sequence()); // } template struct integer_sequence { using value_type = T; static constexpr std::size_t size() noexcept { return sizeof...(Ints); } }; // index_sequence // // A helper template for an `integer_sequence` of `size_t`, // `absl::index_sequence` is designed to be a drop-in replacement for C++14's // `std::index_sequence`. template using index_sequence = integer_sequence; namespace utility_internal { template struct Extend; // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. template struct Extend, SeqSize, 0> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; }; template struct Extend, SeqSize, 1> { using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; }; // Recursion helper for 'make_integer_sequence'. // 'Gen::type' is an alias for 'integer_sequence'. template struct Gen { using type = typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; }; template struct Gen { using type = integer_sequence; }; } // namespace utility_internal // Compile-time sequences of integers // make_integer_sequence // // This template alias is equivalent to // `integer_sequence`, and is designed to be a drop-in // replacement for C++14's `std::make_integer_sequence`. template using make_integer_sequence = typename utility_internal::Gen::type; // make_index_sequence // // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, // and is designed to be a drop-in replacement for C++14's // `std::make_index_sequence`. template using make_index_sequence = make_integer_sequence; // index_sequence_for // // Converts a typename pack into an index sequence of the same length, and // is designed to be a drop-in replacement for C++14's // `std::index_sequence_for()` template using index_sequence_for = make_index_sequence; //// END OF CODE FROM GOOGLE ABSEIL #endif // dispatch utility (taken from ranges-v3) template struct priority_tag : priority_tag < N - 1 > {}; template<> struct priority_tag<0> {}; // taken from ranges-v3 template struct static_const { static JSON_INLINE_VARIABLE constexpr T value{}; }; #ifndef JSON_HAS_CPP_17 template constexpr T static_const::value; #endif template constexpr std::array make_array(Args&& ... args) { return std::array {{static_cast(std::forward(args))...}}; } } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/detected.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // https://en.cppreference.com/w/cpp/experimental/is_detected struct nonesuch { nonesuch() = delete; ~nonesuch() = delete; nonesuch(nonesuch const&) = delete; nonesuch(nonesuch const&&) = delete; void operator=(nonesuch const&) = delete; void operator=(nonesuch&&) = delete; }; template class Op, class... Args> struct detector { using value_t = std::false_type; using type = Default; }; template class Op, class... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; template class Op, class... Args> using is_detected = typename detector::value_t; template class Op, class... Args> struct is_detected_lazy : is_detected { }; template class Op, class... Args> using detected_t = typename detector::type; template class Op, class... Args> using detected_or = detector; template class Op, class... Args> using detected_or_t = typename detected_or::type; template class Op, class... Args> using is_detected_exact = std::is_same>; template class Op, class... Args> using is_detected_convertible = std::is_convertible, To>; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/identity_tag.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { // dispatching helper struct template struct identity_tag {}; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/is_sax.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // size_t #include // declval #include // string #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { template using null_function_t = decltype(std::declval().null()); template using boolean_function_t = decltype(std::declval().boolean(std::declval())); template using number_integer_function_t = decltype(std::declval().number_integer(std::declval())); template using number_unsigned_function_t = decltype(std::declval().number_unsigned(std::declval())); template using number_float_function_t = decltype(std::declval().number_float( std::declval(), std::declval())); template using string_function_t = decltype(std::declval().string(std::declval())); template using binary_function_t = decltype(std::declval().binary(std::declval())); template using start_object_function_t = decltype(std::declval().start_object(std::declval())); template using key_function_t = decltype(std::declval().key(std::declval())); template using end_object_function_t = decltype(std::declval().end_object()); template using start_array_function_t = decltype(std::declval().start_array(std::declval())); template using end_array_function_t = decltype(std::declval().end_array()); template using parse_error_function_t = decltype(std::declval().parse_error( std::declval(), std::declval(), std::declval())); template struct is_sax { private: static_assert(is_basic_json::value, "BasicJsonType must be of type basic_json<...>"); using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; using exception_t = typename BasicJsonType::exception; public: static constexpr bool value = is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value && is_detected_exact::value; }; template struct is_sax_static_asserts { private: static_assert(is_basic_json::value, "BasicJsonType must be of type basic_json<...>"); using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; using string_t = typename BasicJsonType::string_t; using binary_t = typename BasicJsonType::binary_t; using exception_t = typename BasicJsonType::exception; public: static_assert(is_detected_exact::value, "Missing/invalid function: bool null()"); static_assert(is_detected_exact::value, "Missing/invalid function: bool boolean(bool)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool boolean(bool)"); static_assert( is_detected_exact::value, "Missing/invalid function: bool number_integer(number_integer_t)"); static_assert( is_detected_exact::value, "Missing/invalid function: bool number_unsigned(number_unsigned_t)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool number_float(number_float_t, const string_t&)"); static_assert( is_detected_exact::value, "Missing/invalid function: bool string(string_t&)"); static_assert( is_detected_exact::value, "Missing/invalid function: bool binary(binary_t&)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool start_object(std::size_t)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool key(string_t&)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool end_object()"); static_assert(is_detected_exact::value, "Missing/invalid function: bool start_array(std::size_t)"); static_assert(is_detected_exact::value, "Missing/invalid function: bool end_array()"); static_assert( is_detected_exact::value, "Missing/invalid function: bool parse_error(std::size_t, const " "std::string&, const exception&)"); }; } // namespace detail NLOHMANN_JSON_NAMESPACE_END ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/std_fs.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include #if JSON_HAS_EXPERIMENTAL_FILESYSTEM #include NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { namespace std_fs = std::experimental::filesystem; } // namespace detail NLOHMANN_JSON_NAMESPACE_END #elif JSON_HAS_FILESYSTEM #include // NOLINT(build/c++17) NLOHMANN_JSON_NAMESPACE_BEGIN namespace detail { namespace std_fs = std::filesystem; } // namespace detail NLOHMANN_JSON_NAMESPACE_END #endif ================================================ FILE: Game Trainers/common/include/nlohmann/detail/meta/type_traits.hpp ================================================ // __ _____ _____ _____ // __| | __| | | | JSON for Modern C++ // | | |__ | | | | | | version 3.11.3 // |_____|_____|_____|_|___| https://github.com/nlohmann/json // // SPDX-FileCopyrightText: 2013 - 2024 Niels Lohmann // SPDX-License-Identifier: MIT #pragma once #include // numeric_limits #include // char_traits #include // tuple #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval #include #include #include #include #include #include #include NLOHMANN_JSON_NAMESPACE_BEGIN /*! @brief detail namespace with internal helper functions This namespace collects functions that should not be exposed, implementations of some @ref basic_json methods, and meta-programming helpers. @since version 2.1.0 */ namespace detail { ///////////// // helpers // ///////////// // Note to maintainers: // // Every trait in this file expects a non CV-qualified type. // The only exceptions are in the 'aliases for detected' section // (i.e. those of the form: decltype(T::member_function(std::declval()))) // // In this case, T has to be properly CV-qualified to constraint the function arguments // (e.g. to_json(BasicJsonType&, const T&)) template struct is_basic_json : std::false_type {}; NLOHMANN_BASIC_JSON_TPL_DECLARATION struct is_basic_json : std::true_type {}; // used by exceptions create() member functions // true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t // false_type otherwise template struct is_basic_json_context : std::integral_constant < bool, is_basic_json::type>::type>::value || std::is_same::value > {}; ////////////////////// // json_ref helpers // ////////////////////// template class json_ref; template struct is_json_ref : std::false_type {}; template struct is_json_ref> : std::true_type {}; ////////////////////////// // aliases for detected // ////////////////////////// template using mapped_type_t = typename T::mapped_type; template using key_type_t = typename T::key_type; template using value_type_t = typename T::value_type; template using difference_type_t = typename T::difference_type; template using pointer_t = typename T::pointer; template using reference_t = typename T::reference; template using iterator_category_t = typename T::iterator_category; template using to_json_function = decltype(T::to_json(std::declval()...)); template using from_json_function = decltype(T::from_json(std::declval()...)); template using get_template_function = decltype(std::declval().template get()); // trait checking if JSONSerializer::from_json(json const&, udt&) exists template struct has_from_json : std::false_type {}; // trait checking if j.get is valid // use this trait instead of std::is_constructible or std::is_convertible, // both rely on, or make use of implicit conversions, and thus fail when T // has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) template struct is_getable { static constexpr bool value = is_detected::value; }; template struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if JSONSerializer::from_json(json const&) exists // this overload is used for non-default-constructible user-defined-types template struct has_non_default_from_json : std::false_type {}; template struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; // This trait checks if BasicJsonType::json_serializer::to_json exists // Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. template struct has_to_json : std::false_type {}; template struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = is_detected_exact::value; }; template using detect_key_compare = typename T::key_compare; template struct has_key_compare : std::integral_constant::value> {}; // obtains the actual object key comparator template struct actual_object_comparator { using object_t = typename BasicJsonType::object_t; using object_comparator_t = typename BasicJsonType::default_object_comparator_t; using type = typename std::conditional < has_key_compare::value, typename object_t::key_compare, object_comparator_t>::type; }; template using actual_object_comparator_t = typename actual_object_comparator::type; ///////////////// // char_traits // ///////////////// // Primary template of char_traits calls std char_traits template struct char_traits : std::char_traits {}; // Explicitly define char traits for unsigned char since it is not standard template<> struct char_traits : std::char_traits { using char_type = unsigned char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(std::char_traits::eof()); } }; // Explicitly define char traits for signed char since it is not standard template<> struct char_traits : std::char_traits { using char_type = signed char; using int_type = uint64_t; // Redefine to_int_type function static int_type to_int_type(char_type c) noexcept { return static_cast(c); } static char_type to_char_type(int_type i) noexcept { return static_cast(i); } static constexpr int_type eof() noexcept { return static_cast(std::char_traits::eof()); } }; /////////////////// // is_ functions // /////////////////// // https://en.cppreference.com/w/cpp/types/conjunction template struct conjunction : std::true_type { }; template struct conjunction : B { }; template struct conjunction : std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; // Reimplementation of is_constructible and is_default_constructible, due to them being broken for // std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). // This causes compile errors in e.g. clang 3.5 or gcc 4.9. template struct is_default_constructible : std::is_default_constructible {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction, is_default_constructible> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_default_constructible> : conjunction...> {}; template struct is_constructible : std::is_constructible {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_constructible> : is_default_constructible> {}; template struct is_iterator_traits : std::false_type {}; template struct is_iterator_traits> { private: using traits = iterator_traits; public: static constexpr auto value = is_detected::value && is_detected::value && is_detected::value && is_detected::value && is_detected::value; }; template struct is_range { private: using t_ref = typename std::add_lvalue_reference::type; using iterator = detected_t; using sentinel = detected_t; // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator // and https://en.cppreference.com/w/cpp/iterator/sentinel_for // but reimplementing these would be too much work, as a lot of other concepts are used underneath static constexpr auto is_iterator_begin = is_iterator_traits>::value; public: static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; }; template using iterator_t = enable_if_t::value, result_of_begin())>>; template using range_value_t = value_type_t>>; // The following implementation of is_complete_type is taken from // https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ // and is written by Xiang Fan who agreed to using it in this library. template struct is_complete_type : std::false_type {}; template struct is_complete_type : std::true_type {}; template struct is_compatible_object_type_impl : std::false_type {}; template struct is_compatible_object_type_impl < BasicJsonType, CompatibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; // macOS's is_constructible does not play well with nonesuch... static constexpr bool value = is_constructible::value && is_constructible::value; }; template struct is_compatible_object_type : is_compatible_object_type_impl {}; template struct is_constructible_object_type_impl : std::false_type {}; template struct is_constructible_object_type_impl < BasicJsonType, ConstructibleObjectType, enable_if_t < is_detected::value&& is_detected::value >> { using object_t = typename BasicJsonType::object_t; static constexpr bool value = (is_default_constructible::value && (std::is_move_assignable::value || std::is_copy_assignable::value) && (is_constructible::value && std::is_same < typename object_t::mapped_type, typename ConstructibleObjectType::mapped_type >::value)) || (has_from_json::value || has_non_default_from_json < BasicJsonType, typename ConstructibleObjectType::mapped_type >::value); }; template struct is_constructible_object_type : is_constructible_object_type_impl {}; template struct is_compatible_string_type { static constexpr auto value = is_constructible::value; }; template struct is_constructible_string_type { // launder type through decltype() to fix compilation failure on ICPC #ifdef __INTEL_COMPILER using laundered_type = decltype(std::declval()); #else using laundered_type = ConstructibleStringType; #endif static constexpr auto value = conjunction < is_constructible, is_detected_exact>::value; }; template struct is_compatible_array_type_impl : std::false_type {}; template struct is_compatible_array_type_impl < BasicJsonType, CompatibleArrayType, enable_if_t < is_detected::value&& is_iterator_traits>>::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value >> { static constexpr bool value = is_constructible>::value; }; template struct is_compatible_array_type : is_compatible_array_type_impl {}; template struct is_constructible_array_type_impl : std::false_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t::value >> : std::true_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t < !std::is_same::value&& !is_compatible_string_type::value&& is_default_constructible::value&& (std::is_move_assignable::value || std::is_copy_assignable::value)&& is_detected::value&& is_iterator_traits>>::value&& is_detected::value&& // special case for types like std::filesystem::path whose iterator's value_type are themselves // c.f. https://github.com/nlohmann/json/pull/3073 !std::is_same>::value&& is_complete_type < detected_t>::value >> { using value_type = range_value_t; static constexpr bool value = std::is_same::value || has_from_json::value || has_non_default_from_json < BasicJsonType, value_type >::value; }; template struct is_constructible_array_type : is_constructible_array_type_impl {}; template struct is_compatible_integer_type_impl : std::false_type {}; template struct is_compatible_integer_type_impl < RealIntegerType, CompatibleNumberIntegerType, enable_if_t < std::is_integral::value&& std::is_integral::value&& !std::is_same::value >> { // is there an assert somewhere on overflows? using RealLimits = std::numeric_limits; using CompatibleLimits = std::numeric_limits; static constexpr auto value = is_constructible::value && CompatibleLimits::is_integer && RealLimits::is_signed == CompatibleLimits::is_signed; }; template struct is_compatible_integer_type : is_compatible_integer_type_impl {}; template struct is_compatible_type_impl: std::false_type {}; template struct is_compatible_type_impl < BasicJsonType, CompatibleType, enable_if_t::value >> { static constexpr bool value = has_to_json::value; }; template struct is_compatible_type : is_compatible_type_impl {}; template struct is_constructible_tuple : std::false_type {}; template struct is_constructible_tuple> : conjunction...> {}; template struct is_json_iterator_of : std::false_type {}; template struct is_json_iterator_of : std::true_type {}; template struct is_json_iterator_of : std::true_type {}; // checks if a given type T is a template specialization of Primary template