From d24a80d70f78ed0cf0c1ad6091837b88f1c6334b Mon Sep 17 00:00:00 2001 From: Sohom Sahaun Date: Wed, 19 Apr 2023 00:47:46 +0600 Subject: [PATCH] Initial Commit --- Example/Example.resource_order | 23 ++ Example/Example.yyp | 49 +++ Example/objects/oObject/Create_0.gml | 2 + Example/objects/oObject/Step_0.gml | 1 + Example/objects/oObject/Step_1.gml | 1 + Example/objects/oObject/oObject.yy | 35 ++ Example/objects/oObject2/Alarm_0.gml | 1 + Example/objects/oObject2/Create_0.gml | 1 + Example/objects/oObject2/KeyRelease_27.gml | 1 + Example/objects/oObject2/Step_0.gml | 3 + Example/objects/oObject2/oObject2.yy | 36 ++ Example/options/android/options_android.yy | 77 +++++ Example/options/html5/options_html5.yy | 33 ++ Example/options/ios/options_ios.yy | 46 +++ Example/options/linux/options_linux.yy | 24 ++ Example/options/mac/options_mac.yy | 35 ++ Example/options/main/options_main.yy | 20 ++ Example/options/operagx/options_operagx.yy | 18 + Example/options/ps4/options_ps4.yy | 35 ++ Example/options/ps5/options_ps5.yy | 25 ++ Example/options/switch/options_switch.yy | 15 + Example/options/tvos/options_tvos.yy | 28 ++ Example/options/windows/options_windows.yy | 34 ++ .../xboxseriesxs/options_xboxseriesxs.yy | 41 +++ Example/rooms/rRoom/rRoom.yy | 57 ++++ Example/scripts/scrScript/scrScript.gml | 3 + Example/scripts/scrScript/scrScript.yy | 11 + Example/scripts/scrScript2/scrScript2.gml | 4 + Example/scripts/scrScript2/scrScript2.yy | 11 + index.js | 64 ++++ out/Example.txt | 35 ++ package-lock.json | 309 ++++++++++++++++++ package.json | 17 + src/File.js | 32 ++ src/Log.js | 21 ++ src/Types.js | 96 ++++++ 36 files changed, 1244 insertions(+) create mode 100644 Example/Example.resource_order create mode 100644 Example/Example.yyp create mode 100644 Example/objects/oObject/Create_0.gml create mode 100644 Example/objects/oObject/Step_0.gml create mode 100644 Example/objects/oObject/Step_1.gml create mode 100644 Example/objects/oObject/oObject.yy create mode 100644 Example/objects/oObject2/Alarm_0.gml create mode 100644 Example/objects/oObject2/Create_0.gml create mode 100644 Example/objects/oObject2/KeyRelease_27.gml create mode 100644 Example/objects/oObject2/Step_0.gml create mode 100644 Example/objects/oObject2/oObject2.yy create mode 100644 Example/options/android/options_android.yy create mode 100644 Example/options/html5/options_html5.yy create mode 100644 Example/options/ios/options_ios.yy create mode 100644 Example/options/linux/options_linux.yy create mode 100644 Example/options/mac/options_mac.yy create mode 100644 Example/options/main/options_main.yy create mode 100644 Example/options/operagx/options_operagx.yy create mode 100644 Example/options/ps4/options_ps4.yy create mode 100644 Example/options/ps5/options_ps5.yy create mode 100644 Example/options/switch/options_switch.yy create mode 100644 Example/options/tvos/options_tvos.yy create mode 100644 Example/options/windows/options_windows.yy create mode 100644 Example/options/xboxseriesxs/options_xboxseriesxs.yy create mode 100644 Example/rooms/rRoom/rRoom.yy create mode 100644 Example/scripts/scrScript/scrScript.gml create mode 100644 Example/scripts/scrScript/scrScript.yy create mode 100644 Example/scripts/scrScript2/scrScript2.gml create mode 100644 Example/scripts/scrScript2/scrScript2.yy create mode 100644 index.js create mode 100644 out/Example.txt create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/File.js create mode 100644 src/Log.js create mode 100644 src/Types.js diff --git a/Example/Example.resource_order b/Example/Example.resource_order new file mode 100644 index 0000000..a499c9f --- /dev/null +++ b/Example/Example.resource_order @@ -0,0 +1,23 @@ +{ + "FolderOrderSettings": [ + {"name":"Animation Curves","order":12,"path":"folders/Animation Curves.yy",}, + {"name":"Extensions","order":14,"path":"folders/Extensions.yy",}, + {"name":"Fonts","order":7,"path":"folders/Fonts.yy",}, + {"name":"Notes","order":13,"path":"folders/Notes.yy",}, + {"name":"Objects","order":9,"path":"folders/Objects.yy",}, + {"name":"Particle Systems","order":15,"path":"folders/Particle Systems.yy",}, + {"name":"Paths","order":4,"path":"folders/Paths.yy",}, + {"name":"Rooms","order":10,"path":"folders/Rooms.yy",}, + {"name":"Scripts","order":5,"path":"folders/Scripts.yy",}, + {"name":"Sequences","order":11,"path":"folders/Sequences.yy",}, + {"name":"Shaders","order":6,"path":"folders/Shaders.yy",}, + {"name":"Sounds","order":3,"path":"folders/Sounds.yy",}, + {"name":"Sprites","order":1,"path":"folders/Sprites.yy",}, + {"name":"Tile Sets","order":2,"path":"folders/Tile Sets.yy",}, + {"name":"Timelines","order":8,"path":"folders/Timelines.yy",}, + ], + "ResourceOrderSettings": [ + {"name":"scrScript2","order":1,"path":"scripts/scrScript2/scrScript2.yy",}, + {"name":"oObject2","order":1,"path":"objects/oObject2/oObject2.yy",}, + ], +} \ No newline at end of file diff --git a/Example/Example.yyp b/Example/Example.yyp new file mode 100644 index 0000000..f60f59a --- /dev/null +++ b/Example/Example.yyp @@ -0,0 +1,49 @@ +{ + "resourceType": "GMProject", + "resourceVersion": "1.7", + "name": "Example", + "AudioGroups": [ + {"resourceType":"GMAudioGroup","resourceVersion":"1.3","name":"audiogroup_default","targets":-1,}, + ], + "configs": { + "children": [], + "name": "Default", + }, + "defaultScriptType": 1, + "Folders": [ + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Animation Curves","folderPath":"folders/Animation Curves.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Extensions","folderPath":"folders/Extensions.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Fonts","folderPath":"folders/Fonts.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Notes","folderPath":"folders/Notes.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Objects","folderPath":"folders/Objects.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Particle Systems","folderPath":"folders/Particle Systems.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Paths","folderPath":"folders/Paths.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Rooms","folderPath":"folders/Rooms.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Scripts","folderPath":"folders/Scripts.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Sequences","folderPath":"folders/Sequences.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Shaders","folderPath":"folders/Shaders.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Sounds","folderPath":"folders/Sounds.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Sprites","folderPath":"folders/Sprites.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Tile Sets","folderPath":"folders/Tile Sets.yy",}, + {"resourceType":"GMFolder","resourceVersion":"1.0","name":"Timelines","folderPath":"folders/Timelines.yy",}, + ], + "IncludedFiles": [], + "isEcma": false, + "LibraryEmitters": [], + "MetaData": { + "IDEVersion": "2023.2.1.75", + }, + "resources": [ + {"id":{"name":"scrScript2","path":"scripts/scrScript2/scrScript2.yy",},}, + {"id":{"name":"oObject2","path":"objects/oObject2/oObject2.yy",},}, + {"id":{"name":"oObject","path":"objects/oObject/oObject.yy",},}, + {"id":{"name":"scrScript","path":"scripts/scrScript/scrScript.yy",},}, + {"id":{"name":"rRoom","path":"rooms/rRoom/rRoom.yy",},}, + ], + "RoomOrderNodes": [ + {"roomId":{"name":"rRoom","path":"rooms/rRoom/rRoom.yy",},}, + ], + "TextureGroups": [ + {"resourceType":"GMTextureGroup","resourceVersion":"1.3","name":"Default","autocrop":true,"border":2,"compressFormat":"bz2","directory":"","groupParent":null,"isScaled":true,"loadType":"default","mipsToGenerate":0,"targets":-1,}, + ], +} \ No newline at end of file diff --git a/Example/objects/oObject/Create_0.gml b/Example/objects/oObject/Create_0.gml new file mode 100644 index 0000000..e48b184 --- /dev/null +++ b/Example/objects/oObject/Create_0.gml @@ -0,0 +1,2 @@ +hspd = 1; +vspd = 2; \ No newline at end of file diff --git a/Example/objects/oObject/Step_0.gml b/Example/objects/oObject/Step_0.gml new file mode 100644 index 0000000..82af2e3 --- /dev/null +++ b/Example/objects/oObject/Step_0.gml @@ -0,0 +1 @@ +// Dummy step event \ No newline at end of file diff --git a/Example/objects/oObject/Step_1.gml b/Example/objects/oObject/Step_1.gml new file mode 100644 index 0000000..4a7638f --- /dev/null +++ b/Example/objects/oObject/Step_1.gml @@ -0,0 +1 @@ +can_someone_explain_how_collision_code_works(hspd, vspd); \ No newline at end of file diff --git a/Example/objects/oObject/oObject.yy b/Example/objects/oObject/oObject.yy new file mode 100644 index 0000000..ea459b8 --- /dev/null +++ b/Example/objects/oObject/oObject.yy @@ -0,0 +1,35 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "oObject", + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,}, + ], + "managed": true, + "overriddenProperties": [], + "parent": { + "name": "Objects", + "path": "folders/Objects.yy", + }, + "parentObjectId": null, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, +} \ No newline at end of file diff --git a/Example/objects/oObject2/Alarm_0.gml b/Example/objects/oObject2/Alarm_0.gml new file mode 100644 index 0000000..8f95342 --- /dev/null +++ b/Example/objects/oObject2/Alarm_0.gml @@ -0,0 +1 @@ +// Dummy alarm event \ No newline at end of file diff --git a/Example/objects/oObject2/Create_0.gml b/Example/objects/oObject2/Create_0.gml new file mode 100644 index 0000000..0ffec94 --- /dev/null +++ b/Example/objects/oObject2/Create_0.gml @@ -0,0 +1 @@ +alarm[0] = 1; \ No newline at end of file diff --git a/Example/objects/oObject2/KeyRelease_27.gml b/Example/objects/oObject2/KeyRelease_27.gml new file mode 100644 index 0000000..c1cd83e --- /dev/null +++ b/Example/objects/oObject2/KeyRelease_27.gml @@ -0,0 +1 @@ +game_end(); \ No newline at end of file diff --git a/Example/objects/oObject2/Step_0.gml b/Example/objects/oObject2/Step_0.gml new file mode 100644 index 0000000..9c2024c --- /dev/null +++ b/Example/objects/oObject2/Step_0.gml @@ -0,0 +1,3 @@ +if (keyboard_check_pressed(vk_enter)) { + thank_you(); +} \ No newline at end of file diff --git a/Example/objects/oObject2/oObject2.yy b/Example/objects/oObject2/oObject2.yy new file mode 100644 index 0000000..167ffd3 --- /dev/null +++ b/Example/objects/oObject2/oObject2.yy @@ -0,0 +1,36 @@ +{ + "resourceType": "GMObject", + "resourceVersion": "1.0", + "name": "oObject2", + "eventList": [ + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, + {"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":27,"eventType":10,"isDnD":false,}, + ], + "managed": true, + "overriddenProperties": [], + "parent": { + "name": "Objects", + "path": "folders/Objects.yy", + }, + "parentObjectId": null, + "persistent": false, + "physicsAngularDamping": 0.1, + "physicsDensity": 0.5, + "physicsFriction": 0.2, + "physicsGroup": 1, + "physicsKinematic": false, + "physicsLinearDamping": 0.1, + "physicsObject": false, + "physicsRestitution": 0.1, + "physicsSensor": false, + "physicsShape": 1, + "physicsShapePoints": [], + "physicsStartAwake": true, + "properties": [], + "solid": false, + "spriteId": null, + "spriteMaskId": null, + "visible": true, +} \ No newline at end of file diff --git a/Example/options/android/options_android.yy b/Example/options/android/options_android.yy new file mode 100644 index 0000000..98c963d --- /dev/null +++ b/Example/options/android/options_android.yy @@ -0,0 +1,77 @@ +{ + "resourceType": "GMAndroidOptions", + "resourceVersion": "1.0", + "name": "Android", + "option_android_application_tag_inject": "", + "option_android_arch_arm64": true, + "option_android_arch_armv7": false, + "option_android_arch_x86_64": false, + "option_android_build_tools": "", + "option_android_compile_sdk": "", + "option_android_device_support": 0, + "option_android_display_name": "Created with GameMaker", + "option_android_facebook_app_display_name": "", + "option_android_facebook_id": "", + "option_android_gamepad_support": true, + "option_android_google_apk_expansion": false, + "option_android_google_cloud_saving": false, + "option_android_google_dynamic_asset_delivery": false, + "option_android_google_licensing_public_key": "", + "option_android_google_services_app_id": "", + "option_android_icon_adaptive_generate": false, + "option_android_icon_adaptive_hdpi": "${base_options_dir}/android/icons_adaptive/hdpi.png", + "option_android_icon_adaptive_ldpi": "${base_options_dir}/android/icons_adaptive/ldpi.png", + "option_android_icon_adaptive_mdpi": "${base_options_dir}/android/icons_adaptive/mdpi.png", + "option_android_icon_adaptive_xhdpi": "${base_options_dir}/android/icons_adaptive/xhdpi.png", + "option_android_icon_adaptive_xxhdpi": "${base_options_dir}/android/icons_adaptive/xxhdpi.png", + "option_android_icon_adaptive_xxxhdpi": "${base_options_dir}/android/icons_adaptive/xxxhdpi.png", + "option_android_icon_adaptivebg_hdpi": "${base_options_dir}/android/icons_adaptivebg/hdpi.png", + "option_android_icon_adaptivebg_ldpi": "${base_options_dir}/android/icons_adaptivebg/ldpi.png", + "option_android_icon_adaptivebg_mdpi": "${base_options_dir}/android/icons_adaptivebg/mdpi.png", + "option_android_icon_adaptivebg_xhdpi": "${base_options_dir}/android/icons_adaptivebg/xhdpi.png", + "option_android_icon_adaptivebg_xxhdpi": "${base_options_dir}/android/icons_adaptivebg/xxhdpi.png", + "option_android_icon_adaptivebg_xxxhdpi": "${base_options_dir}/android/icons_adaptivebg/xxxhdpi.png", + "option_android_icon_hdpi": "${base_options_dir}/android/icons/hdpi.png", + "option_android_icon_ldpi": "${base_options_dir}/android/icons/ldpi.png", + "option_android_icon_mdpi": "${base_options_dir}/android/icons/mdpi.png", + "option_android_icon_xhdpi": "${base_options_dir}/android/icons/xhdpi.png", + "option_android_icon_xxhdpi": "${base_options_dir}/android/icons/xxhdpi.png", + "option_android_icon_xxxhdpi": "${base_options_dir}/android/icons/xxxhdpi.png", + "option_android_install_location": 0, + "option_android_interpolate_pixels": false, + "option_android_launchscreen_fill": 0, + "option_android_lint": false, + "option_android_logcat": "yoyo:V DEBUG:V AndroidRuntime:V", + "option_android_minimum_sdk": "", + "option_android_orient_landscape": true, + "option_android_orient_landscape_flipped": true, + "option_android_orient_portrait": true, + "option_android_orient_portrait_flipped": true, + "option_android_package_company": "company", + "option_android_package_domain": "com", + "option_android_package_product": "game", + "option_android_permission_bluetooth": true, + "option_android_permission_internet": true, + "option_android_permission_network_state": false, + "option_android_permission_read_phone_state": false, + "option_android_permission_record_audio": false, + "option_android_permission_write_external_storage": false, + "option_android_proguard_minifying": false, + "option_android_proguard_shrinking": false, + "option_android_scale": 0, + "option_android_screen_depth": 0, + "option_android_sleep_margin": 4, + "option_android_splash_screens_landscape": "${base_options_dir}/android/splash/landscape.png", + "option_android_splash_screens_portrait": "${base_options_dir}/android/splash/portrait.png", + "option_android_splash_time": 0, + "option_android_splashscreen_background_colour": 255, + "option_android_support_lib": "", + "option_android_sync_amazon": false, + "option_android_target_sdk": "", + "option_android_texture_page": "2048x2048", + "option_android_tools_from_version": false, + "option_android_tv_banner": "${base_options_dir}/android/tv_banner.png", + "option_android_tv_isgame": true, + "option_android_use_facebook": false, + "option_android_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/options/html5/options_html5.yy b/Example/options/html5/options_html5.yy new file mode 100644 index 0000000..eda4049 --- /dev/null +++ b/Example/options/html5/options_html5.yy @@ -0,0 +1,33 @@ +{ + "resourceType": "GMHtml5Options", + "resourceVersion": "1.0", + "name": "HTML5", + "option_html5_allow_fullscreen": true, + "option_html5_browser_title": "Created with GameMaker", + "option_html5_centregame": false, + "option_html5_display_cursor": true, + "option_html5_facebook_app_display_name": "", + "option_html5_facebook_id": "", + "option_html5_flurry_enable": false, + "option_html5_flurry_id": "", + "option_html5_foldername": "html5game", + "option_html5_google_analytics_enable": false, + "option_html5_google_tracking_id": "", + "option_html5_icon": "${base_options_dir}/html5/fav.ico", + "option_html5_index": "", + "option_html5_interpolate_pixels": true, + "option_html5_jsprepend": "", + "option_html5_loadingbar": "", + "option_html5_localrunalert": true, + "option_html5_outputdebugtoconsole": true, + "option_html5_outputname": "index.html", + "option_html5_scale": 0, + "option_html5_splash_png": "${base_options_dir}/html5/splash.png", + "option_html5_texture_page": "2048x2048", + "option_html5_use_facebook": false, + "option_html5_usebuiltinfont": true, + "option_html5_usebuiltinparticles": true, + "option_html5_usesplash": false, + "option_html5_version": "1.0.0.0", + "option_html5_webgl": 2, +} \ No newline at end of file diff --git a/Example/options/ios/options_ios.yy b/Example/options/ios/options_ios.yy new file mode 100644 index 0000000..382c05f --- /dev/null +++ b/Example/options/ios/options_ios.yy @@ -0,0 +1,46 @@ +{ + "resourceType": "GMiOSOptions", + "resourceVersion": "1.3", + "name": "iOS", + "option_ios_bundle_name": "com.company.game", + "option_ios_cocoapods_checkbox": true, + "option_ios_defer_home_indicator": false, + "option_ios_devices": 2, + "option_ios_display_name": "Created with GameMaker", + "option_ios_half_ipad1_textures": false, + "option_ios_icon_ipad_app_152": "${base_options_dir}/ios/icons/app/ipad_152.png", + "option_ios_icon_ipad_app_76": "${base_options_dir}/ios/icons/app/ipad_76.png", + "option_ios_icon_ipad_notification_20": "${base_options_dir}/ios/icons/notification/ipad_20.png", + "option_ios_icon_ipad_notification_40": "${base_options_dir}/ios/icons/notification/ipad_40.png", + "option_ios_icon_ipad_pro_app_167": "${base_options_dir}/ios/icons/app/ipad_pro_167.png", + "option_ios_icon_ipad_settings_29": "${base_options_dir}/ios/icons/settings/ipad_29.png", + "option_ios_icon_ipad_settings_58": "${base_options_dir}/ios/icons/settings/ipad_58.png", + "option_ios_icon_ipad_spotlight_40": "${base_options_dir}/ios/icons/spotlight/ipad_40.png", + "option_ios_icon_ipad_spotlight_80": "${base_options_dir}/ios/icons/spotlight/ipad_80.png", + "option_ios_icon_iphone_app_120": "${base_options_dir}/ios/icons/app/iphone_120.png", + "option_ios_icon_iphone_app_180": "${base_options_dir}/ios/icons/app/iphone_180.png", + "option_ios_icon_iphone_notification_40": "${base_options_dir}/ios/icons/notification/iphone_40.png", + "option_ios_icon_iphone_notification_60": "${base_options_dir}/ios/icons/notification/iphone_60.png", + "option_ios_icon_iphone_settings_58": "${base_options_dir}/ios/icons/settings/iphone_58.png", + "option_ios_icon_iphone_settings_87": "${base_options_dir}/ios/icons/settings/iphone_87.png", + "option_ios_icon_iphone_spotlight_120": "${base_options_dir}/ios/icons/spotlight/iphone_120.png", + "option_ios_icon_iphone_spotlight_80": "${base_options_dir}/ios/icons/spotlight/iphone_80.png", + "option_ios_icon_itunes_artwork_1024": "${base_options_dir}/ios/icons/itunes/itunes_1024.png", + "option_ios_interpolate_pixels": false, + "option_ios_launchscreen_fill": 0, + "option_ios_launchscreen_image": "${base_options_dir}/ios/splash/launchscreen.png", + "option_ios_launchscreen_image_landscape": "${base_options_dir}/ios/splash/launchscreen-landscape.png", + "option_ios_min_version": "10.0", + "option_ios_orientation_landscape": true, + "option_ios_orientation_landscape_flipped": true, + "option_ios_orientation_portrait": true, + "option_ios_orientation_portrait_flipped": true, + "option_ios_output_dir": "~/gamemakerstudio2", + "option_ios_podfile_lock_path": "${options_dir}/ios/Podfile.lock", + "option_ios_podfile_path": "${options_dir}/ios/Podfile", + "option_ios_scale": 0, + "option_ios_splashscreen_background_colour": 255, + "option_ios_team_id": "", + "option_ios_texture_page": "2048x2048", + "option_ios_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/options/linux/options_linux.yy b/Example/options/linux/options_linux.yy new file mode 100644 index 0000000..b6c5a50 --- /dev/null +++ b/Example/options/linux/options_linux.yy @@ -0,0 +1,24 @@ +{ + "resourceType": "GMLinuxOptions", + "resourceVersion": "1.0", + "name": "Linux", + "option_linux_allow_fullscreen": false, + "option_linux_disable_sandbox": false, + "option_linux_display_cursor": true, + "option_linux_display_name": "Created with GameMaker", + "option_linux_display_splash": false, + "option_linux_enable_steam": false, + "option_linux_homepage": "http://www.yoyogames.com", + "option_linux_icon": "${base_options_dir}/linux/icons/64.png", + "option_linux_interpolate_pixels": true, + "option_linux_long_desc": "", + "option_linux_maintainer_email": "", + "option_linux_resize_window": false, + "option_linux_scale": 0, + "option_linux_short_desc": "", + "option_linux_splash_screen": "${base_options_dir}/linux/splash/splash.png", + "option_linux_start_fullscreen": false, + "option_linux_sync": false, + "option_linux_texture_page": "2048x2048", + "option_linux_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/options/mac/options_mac.yy b/Example/options/mac/options_mac.yy new file mode 100644 index 0000000..3d2d171 --- /dev/null +++ b/Example/options/mac/options_mac.yy @@ -0,0 +1,35 @@ +{ + "resourceType": "GMMacOptions", + "resourceVersion": "1.0", + "name": "macOS", + "option_mac_allow_fullscreen": false, + "option_mac_allow_incoming_network": false, + "option_mac_allow_outgoing_network": false, + "option_mac_app_category": "Games", + "option_mac_app_id": "com.company.game", + "option_mac_apple_sign_in": false, + "option_mac_arm64": true, + "option_mac_build_app_store": false, + "option_mac_copyright": "", + "option_mac_disable_sandbox": false, + "option_mac_display_cursor": true, + "option_mac_display_name": "Created with GameMaker", + "option_mac_enable_retina": false, + "option_mac_enable_steam": false, + "option_mac_icon_png": "${base_options_dir}/mac/icons/1024.png", + "option_mac_installer_background_png": "${base_options_dir}/mac/splash/installer_background.png", + "option_mac_interpolate_pixels": true, + "option_mac_menu_dock": false, + "option_mac_min_version": "10.10", + "option_mac_output_dir": "~/gamemakerstudio2", + "option_mac_resize_window": false, + "option_mac_scale": 0, + "option_mac_signing_identity": "Developer ID Application:", + "option_mac_splash_png": "${base_options_dir}/mac/splash/splash.png", + "option_mac_start_fullscreen": false, + "option_mac_team_id": "", + "option_mac_texture_page": "2048x2048", + "option_mac_version": "1.0.0.0", + "option_mac_vsync": false, + "option_mac_x86_64": true, +} \ No newline at end of file diff --git a/Example/options/main/options_main.yy b/Example/options/main/options_main.yy new file mode 100644 index 0000000..078cad1 --- /dev/null +++ b/Example/options/main/options_main.yy @@ -0,0 +1,20 @@ +{ + "resourceType": "GMMainOptions", + "resourceVersion": "1.4", + "name": "Main", + "option_author": "", + "option_collision_compatibility": false, + "option_copy_on_write_enabled": false, + "option_draw_colour": 4294967295, + "option_game_speed": 60, + "option_gameguid": "33102240-e456-4d83-837f-2ba7b75cee4e", + "option_gameid": "0", + "option_mips_for_3d_textures": false, + "option_sci_usesci": false, + "option_spine_licence": false, + "option_steam_app_id": "0", + "option_template_description": null, + "option_template_icon": "${base_options_dir}/main/template_icon.png", + "option_template_image": "${base_options_dir}/main/template_image.png", + "option_window_colour": 255, +} \ No newline at end of file diff --git a/Example/options/operagx/options_operagx.yy b/Example/options/operagx/options_operagx.yy new file mode 100644 index 0000000..d01266d --- /dev/null +++ b/Example/options/operagx/options_operagx.yy @@ -0,0 +1,18 @@ +{ + "resourceType": "GMOperaGXOptions", + "resourceVersion": "1.0", + "name": "operagx", + "option_operagx_display_cursor": true, + "option_operagx_editUrl": "", + "option_operagx_game_name": "Test Project", + "option_operagx_guid": "", + "option_operagx_internalShareUrl": "", + "option_operagx_interpolate_pixels": true, + "option_operagx_next_version": "1.0.0.0", + "option_operagx_publicShareUrl": "", + "option_operagx_scale": 0, + "option_operagx_team_id": "", + "option_operagx_team_name": "", + "option_operagx_texture_page": "2048x2048", + "option_operagx_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/options/ps4/options_ps4.yy b/Example/options/ps4/options_ps4.yy new file mode 100644 index 0000000..53cf8ca --- /dev/null +++ b/Example/options/ps4/options_ps4.yy @@ -0,0 +1,35 @@ +{ + "resourceType": "GMPS4Options", + "resourceVersion": "1.0", + "name": "PlayStation 4", + "option_ps4_display_cursor": false, + "option_ps4_garlic": 1024, + "option_ps4_icon": "${base_options_dir}/ps4/sce_sys/icon0.png", + "option_ps4_interpolate_pixels": true, + "option_ps4_max_display_height": -1, + "option_ps4_max_display_width": -1, + "option_ps4_neo_garlic": 1536, + "option_ps4_neo_onion": 2048, + "option_ps4_nptitledat": "", + "option_ps4_nptitledat_file": "${options_dir}\\ps4\\sce_sys\\nptitle.dat", + "option_ps4_nptitleid": "", + "option_ps4_nptitlesecret": "", + "option_ps4_onion": 2048, + "option_ps4_package_id": "IV0002-NPXS29129_00-APP0990000000022", + "option_ps4_paramsfo": "", + "option_ps4_paramsfo_file": "${options_dir}\\ps4\\sce_sys\\param.sfo", + "option_ps4_passcode": "GvE6xCpZxd96scOUGuLPbuLp8O800B0s", + "option_ps4_pronunciation": "", + "option_ps4_pronunciation_file": "${options_dir}\\ps4\\sce_sys\\pronunciation.xml", + "option_ps4_pronunciation_sig": "${options_dir}\\ps4\\sce_sys\\pronunciation.sig", + "option_ps4_save_data_icon": "${base_options_dir}/ps4/sce_sys/save_data.png", + "option_ps4_scale": 0, + "option_ps4_shareoverlay_image": "${base_options_dir}/ps4/sce_sys/shareoverlayimage.png", + "option_ps4_shareparam": "", + "option_ps4_shareparam_file": "${options_dir}\\ps4\\sce_sys\\shareparam.json", + "option_ps4_splash_screen": "${base_options_dir}/ps4/sce_sys/pic1.png", + "option_ps4_texture_page": "2048x2048", + "option_ps4_trophy_screen": "${base_options_dir}/ps4/sce_sys/pic0.png", + "option_ps4_trophy00trp_file": "${options_dir}\\ps4\\sce_sys\\trophy\\trophy00.trp", + "option_ps4_trophyedit": "", +} \ No newline at end of file diff --git a/Example/options/ps5/options_ps5.yy b/Example/options/ps5/options_ps5.yy new file mode 100644 index 0000000..9142c48 --- /dev/null +++ b/Example/options/ps5/options_ps5.yy @@ -0,0 +1,25 @@ +{ + "resourceType": "GMPS5Options", + "resourceVersion": "1.0", + "name": "PlayStation 5", + "option_ps5_display_cursor": false, + "option_ps5_foreground_screen": "${base_options_dir}/ps5/sce_sys/pic2.png", + "option_ps5_icon": "${base_options_dir}/ps5/sce_sys/icon0.png", + "option_ps5_interpolate_pixels": true, + "option_ps5_max_display_height": -1, + "option_ps5_max_display_width": -1, + "option_ps5_nptitledat": "", + "option_ps5_nptitledat_file": "${options_dir}\\ps5\\sce_sys\\nptitle.dat", + "option_ps5_paramsfo": "", + "option_ps5_paramsfo_file": "${options_dir}\\ps5\\sce_sys\\param.sfo", + "option_ps5_passcode": "GvE6xCpZxd96scOUGuLPbuLp8O800B0s", + "option_ps5_save_data_icon": "${base_options_dir}/ps5/sce_sys/save_data.png", + "option_ps5_scale": 0, + "option_ps5_sharedbinarysubconfigs": "", + "option_ps5_shareoverlay_image": "${base_options_dir}/ps5/sce_sys/shareoverlayimage.png", + "option_ps5_splash_screen": "${base_options_dir}/ps5/sce_sys/pic1.png", + "option_ps5_texture_page": "2048x2048", + "option_ps5_trophy_screen": "${base_options_dir}/ps5/sce_sys/pic0.png", + "option_ps5_trophy00trp_file": "${options_dir}\\ps5\\sce_sys\\trophy\\trophy00.trp", + "option_ps5_trophyedit": "", +} \ No newline at end of file diff --git a/Example/options/switch/options_switch.yy b/Example/options/switch/options_switch.yy new file mode 100644 index 0000000..8bda638 --- /dev/null +++ b/Example/options/switch/options_switch.yy @@ -0,0 +1,15 @@ +{ + "resourceType": "GMSwitchOptions", + "resourceVersion": "1.0", + "name": "Switch", + "option_switch_allow_debug_output": false, + "option_switch_check_nsp_publish_errors": true, + "option_switch_enable_fileaccess_checking": true, + "option_switch_enable_nex_libraries": false, + "option_switch_interpolate_pixels": true, + "option_switch_project_nmeta": "${options_dir}/switch/application.nmeta", + "option_switch_scale": 0, + "option_switch_splash_screen": "${base_options_dir}/switch/splash.png", + "option_switch_texture_page": "2048x2048", + "option_switch_use_splash": false, +} \ No newline at end of file diff --git a/Example/options/tvos/options_tvos.yy b/Example/options/tvos/options_tvos.yy new file mode 100644 index 0000000..7e17b25 --- /dev/null +++ b/Example/options/tvos/options_tvos.yy @@ -0,0 +1,28 @@ +{ + "resourceType": "GMtvOSOptions", + "resourceVersion": "1.3", + "name": "tvOS", + "option_tvos_bundle_name": "com.company.game", + "option_tvos_cocoapods_checkbox": true, + "option_tvos_display_cursor": false, + "option_tvos_display_name": "Made in GameMaker", + "option_tvos_icon_1280": "${base_options_dir}/tvos/icons/1280.png", + "option_tvos_icon_400": "${base_options_dir}/tvos/icons/400.png", + "option_tvos_icon_400_2x": "${base_options_dir}/tvos/icons/400_2x.png", + "option_tvos_interpolate_pixels": true, + "option_tvos_min_version": "10.0", + "option_tvos_output_dir": "~/GameMakerStudio2/tvOS", + "option_tvos_podfile_lock_path": "${options_dir}\\tvos\\Podfile.lock", + "option_tvos_podfile_path": "${options_dir}\\tvos\\Podfile", + "option_tvos_scale": 0, + "option_tvos_splash_time": 0, + "option_tvos_splashscreen": "${base_options_dir}/tvos/splash/splash.png", + "option_tvos_splashscreen_2x": "${base_options_dir}/tvos/splash/splash_2x.png", + "option_tvos_team_id": "", + "option_tvos_texture_page": "2048x2048", + "option_tvos_topshelf": "${base_options_dir}/tvos/topshelf/topshelf.png", + "option_tvos_topshelf_2x": "${base_options_dir}/tvos/topshelf/topshelf_2x.png", + "option_tvos_topshelf_wide": "${base_options_dir}/tvos/topshelf/topshelf_wide.png", + "option_tvos_topshelf_wide_2x": "${base_options_dir}/tvos/topshelf/topshelf_wide_2x.png", + "option_tvos_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/options/windows/options_windows.yy b/Example/options/windows/options_windows.yy new file mode 100644 index 0000000..0321be2 --- /dev/null +++ b/Example/options/windows/options_windows.yy @@ -0,0 +1,34 @@ +{ + "resourceType": "GMWindowsOptions", + "resourceVersion": "1.1", + "name": "Windows", + "option_windows_allow_fullscreen_switching": false, + "option_windows_borderless": false, + "option_windows_company_info": "YoYo Games Ltd", + "option_windows_copy_exe_to_dest": false, + "option_windows_copyright_info": "", + "option_windows_description_info": "A GameMaker Game", + "option_windows_disable_sandbox": false, + "option_windows_display_cursor": true, + "option_windows_display_name": "Created with GameMaker", + "option_windows_enable_steam": false, + "option_windows_executable_name": "${project_name}.exe", + "option_windows_icon": "${base_options_dir}/windows/icons/icon.ico", + "option_windows_installer_finished": "${base_options_dir}/windows/installer/finished.bmp", + "option_windows_installer_header": "${base_options_dir}/windows/installer/header.bmp", + "option_windows_interpolate_pixels": false, + "option_windows_license": "${base_options_dir}/windows/installer/license.txt", + "option_windows_nsis_file": "${base_options_dir}/windows/installer/nsis_script.nsi", + "option_windows_product_info": "Created with GameMaker", + "option_windows_resize_window": false, + "option_windows_save_location": 0, + "option_windows_scale": 0, + "option_windows_sleep_margin": 10, + "option_windows_splash_screen": "${base_options_dir}/windows/splash/splash.png", + "option_windows_start_fullscreen": false, + "option_windows_steam_use_alternative_launcher": false, + "option_windows_texture_page": "2048x2048", + "option_windows_use_splash": false, + "option_windows_version": "1.0.0.0", + "option_windows_vsync": false, +} \ No newline at end of file diff --git a/Example/options/xboxseriesxs/options_xboxseriesxs.yy b/Example/options/xboxseriesxs/options_xboxseriesxs.yy new file mode 100644 index 0000000..d0d8ac7 --- /dev/null +++ b/Example/options/xboxseriesxs/options_xboxseriesxs.yy @@ -0,0 +1,41 @@ +{ + "resourceType": "GMXboxSeriesXSOptions", + "resourceVersion": "1.1", + "name": "Xbox Series XS", + "option_xboxseriesxs_content_id": "", + "option_xboxseriesxs_description": "Your Description", + "option_xboxseriesxs_display_name": "Created with GameMaker", + "option_xboxseriesxs_ekbid": "", + "option_xboxseriesxs_foreground_text": 0, + "option_xboxseriesxs_game_chat_slots": 4, + "option_xboxseriesxs_interpolate_pixels": false, + "option_xboxseriesxs_languages": "\n \n \n \n ", + "option_xboxseriesxs_logo_background_colour": 4282795590, + "option_xboxseriesxs_logo_large": "${base_options_dir}/xboxseriesxs/logos/LargeLogo.png", + "option_xboxseriesxs_logo_medium": "${base_options_dir}/xboxseriesxs/logos/Logo.png", + "option_xboxseriesxs_logo_small": "${base_options_dir}/xboxseriesxs/logos/SmallLogo.png", + "option_xboxseriesxs_logo_store": "${base_options_dir}/xboxseriesxs/logos/StoreLogo.png", + "option_xboxseriesxs_msaappid": "", + "option_xboxseriesxs_network_config_manifest": "", + "option_xboxseriesxs_playfab_party_id": "00000", + "option_xboxseriesxs_product_id": "", + "option_xboxseriesxs_program_id": "ExactName.InPartnerCenter", + "option_xboxseriesxs_publisher": "Company Name", + "option_xboxseriesxs_publisher_display_name": "Company Display Name", + "option_xboxseriesxs_require_audio_recording": false, + "option_xboxseriesxs_require_game_chat": false, + "option_xboxseriesxs_require_xbox_live": false, + "option_xboxseriesxs_scale": 0, + "option_xboxseriesxs_service_config_id": "00000000-0000-0000-0000-000000000000", + "option_xboxseriesxs_service_config_manifest": "", + "option_xboxseriesxs_simplified_user_model": false, + "option_xboxseriesxs_splash_screen": "${base_options_dir}/xboxseriesxs/SplashScreen.png", + "option_xboxseriesxs_splash_screen_colour": 4282795590, + "option_xboxseriesxs_stats_system": 0, + "option_xboxseriesxs_store_id": "", + "option_xboxseriesxs_support_4k_one_s": false, + "option_xboxseriesxs_support_4k_one_x": false, + "option_xboxseriesxs_texture_page": "2048x2048", + "option_xboxseriesxs_title_id": "01234567", + "option_xboxseriesxs_version": "1.0.0.0", +} \ No newline at end of file diff --git a/Example/rooms/rRoom/rRoom.yy b/Example/rooms/rRoom/rRoom.yy new file mode 100644 index 0000000..2ab7d7c --- /dev/null +++ b/Example/rooms/rRoom/rRoom.yy @@ -0,0 +1,57 @@ +{ + "resourceType": "GMRoom", + "resourceVersion": "1.0", + "name": "rRoom", + "creationCodeFile": "", + "inheritCode": false, + "inheritCreationOrder": false, + "inheritLayers": false, + "instanceCreationOrder": [ + {"name":"inst_52258DF0","path":"rooms/rRoom/rRoom.yy",}, + {"name":"inst_2F94F237","path":"rooms/rRoom/rRoom.yy",}, + ], + "isDnd": false, + "layers": [ + {"resourceType":"GMRInstanceLayer","resourceVersion":"1.0","name":"Instances","depth":0,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"instances":[ + {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_52258DF0","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"objectId":{"name":"oObject","path":"objects/oObject/oObject.yy",},"properties":[],"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":0.0,"y":0.0,}, + {"resourceType":"GMRInstance","resourceVersion":"1.0","name":"inst_2F94F237","colour":4294967295,"frozen":false,"hasCreationCode":false,"ignore":false,"imageIndex":0,"imageSpeed":1.0,"inheritCode":false,"inheritedItemId":null,"inheritItemSettings":false,"isDnd":false,"objectId":{"name":"oObject2","path":"objects/oObject2/oObject2.yy",},"properties":[],"rotation":0.0,"scaleX":1.0,"scaleY":1.0,"x":32.0,"y":0.0,}, + ],"layers":[],"properties":[],"userdefinedDepth":false,"visible":true,}, + {"resourceType":"GMRBackgroundLayer","resourceVersion":"1.0","name":"Background","animationFPS":15.0,"animationSpeedType":0,"colour":4278190080,"depth":100,"effectEnabled":true,"effectType":null,"gridX":32,"gridY":32,"hierarchyFrozen":false,"hspeed":0.0,"htiled":false,"inheritLayerDepth":false,"inheritLayerSettings":false,"inheritSubLayers":true,"inheritVisibility":true,"layers":[],"properties":[],"spriteId":null,"stretch":false,"userdefinedAnimFPS":false,"userdefinedDepth":false,"visible":true,"vspeed":0.0,"vtiled":false,"x":0,"y":0,}, + ], + "parent": { + "name": "Rooms", + "path": "folders/Rooms.yy", + }, + "parentRoom": null, + "physicsSettings": { + "inheritPhysicsSettings": false, + "PhysicsWorld": false, + "PhysicsWorldGravityX": 0.0, + "PhysicsWorldGravityY": 10.0, + "PhysicsWorldPixToMetres": 0.1, + }, + "roomSettings": { + "Height": 480, + "inheritRoomSettings": false, + "persistent": false, + "Width": 640, + }, + "sequenceId": null, + "views": [ + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + {"hborder":32,"hport":768,"hspeed":-1,"hview":768,"inherit":false,"objectId":null,"vborder":32,"visible":false,"vspeed":-1,"wport":1366,"wview":1366,"xport":0,"xview":0,"yport":0,"yview":0,}, + ], + "viewSettings": { + "clearDisplayBuffer": true, + "clearViewBackground": false, + "enableViews": false, + "inheritViewSettings": false, + }, + "volume": 1.0, +} \ No newline at end of file diff --git a/Example/scripts/scrScript/scrScript.gml b/Example/scripts/scrScript/scrScript.gml new file mode 100644 index 0000000..3fd9509 --- /dev/null +++ b/Example/scripts/scrScript/scrScript.gml @@ -0,0 +1,3 @@ +function can_someone_explain_how_collision_code_works(_hspd, _vspd) { + return "Yes"; +} \ No newline at end of file diff --git a/Example/scripts/scrScript/scrScript.yy b/Example/scripts/scrScript/scrScript.yy new file mode 100644 index 0000000..7f2cfc6 --- /dev/null +++ b/Example/scripts/scrScript/scrScript.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "scrScript", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "Scripts", + "path": "folders/Scripts.yy", + }, +} \ No newline at end of file diff --git a/Example/scripts/scrScript2/scrScript2.gml b/Example/scripts/scrScript2/scrScript2.gml new file mode 100644 index 0000000..c9aea3f --- /dev/null +++ b/Example/scripts/scrScript2/scrScript2.gml @@ -0,0 +1,4 @@ +function thank_you() { + show_message("thank you!"); + thank_you(); +} \ No newline at end of file diff --git a/Example/scripts/scrScript2/scrScript2.yy b/Example/scripts/scrScript2/scrScript2.yy new file mode 100644 index 0000000..7451700 --- /dev/null +++ b/Example/scripts/scrScript2/scrScript2.yy @@ -0,0 +1,11 @@ +{ + "resourceType": "GMScript", + "resourceVersion": "1.0", + "name": "scrScript2", + "isCompatibility": false, + "isDnD": false, + "parent": { + "name": "Scripts", + "path": "folders/Scripts.yy", + }, +} \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..7d3c25f --- /dev/null +++ b/index.js @@ -0,0 +1,64 @@ +#!/usr/bin/env node +const { Object, Script } = require("./src/Types"); +const { parse_file, write_file } = require("./src/File"); + +const yargs = require("yargs/yargs"); +const { hideBin } = require("yargs/helpers"); +const argv = yargs(hideBin(process.argv)).argv; + +let projectPath = ""; +let projectName = ""; + +function init_project(path) { + const ind = path.lastIndexOf("/"); + projectPath = path.slice(0, ind); + + projectName = path.slice(ind+1); + projectName = projectName.slice(0, projectName.lastIndexOf(".")); +} + +function main() { + if (argv.yyp === undefined) { + console.error(`You must provide the yyp path.`); + return; + } + + const yypPath = argv.yyp.replace(/\\/g, "/"); + init_project(yypPath); + + const yyp = parse_file(yypPath, "utf8"); + if (yyp === null) return; + + const getObjects = (argv.obj === true); + const getScripts = (argv.scr === true); + + let objects = []; + let scripts = []; + + yyp.resources.forEach((res) => { + let yyPath = `${projectPath}/${res.id.path}`; + let yyDir = yyPath.slice(0, yyPath.lastIndexOf("/")); + let yy = parse_file(yyPath, "utf8"); + if (getObjects && Object.is(yy)) { + objects.push(new Object(yy.name, yyDir)); + } + if (getScripts && Script.is(yy)) { + scripts.push(new Script(yy.name, yyDir)); + } + }); + + let output = ""; + + if (getObjects) { + objects.sort((a, b) => { return a.name.localeCompare(b.name); }); + objects.forEach((res) => { output += res.to_text(); }); + } + + if (getScripts) { + scripts.sort((a, b) => { return a.name.localeCompare(b.name); }); + scripts.forEach((res) => { output += res.to_text(); }); + } + + write_file(`./out/${projectName}.txt`, output); +} +main(); \ No newline at end of file diff --git a/out/Example.txt b/out/Example.txt new file mode 100644 index 0000000..a564401 --- /dev/null +++ b/out/Example.txt @@ -0,0 +1,35 @@ +/// Object : oObject | Create_0 +hspd = 1; +vspd = 2; + +/// Object : oObject | Step_0 +// Dummy step event + +/// Object : oObject | Step_1 +can_someone_explain_how_collision_code_works(hspd, vspd); + +/// Object : oObject2 | Alarm_0 +// Dummy alarm event + +/// Object : oObject2 | Create_0 +alarm[0] = 1; + +/// Object : oObject2 | KeyRelease_27 +game_end(); + +/// Object : oObject2 | Step_0 +if (keyboard_check_pressed(vk_enter)) { + thank_you(); +} + +/// Script : scrScript +function can_someone_explain_how_collision_code_works(_hspd, _vspd) { + return "Yes"; +} + +/// Script : scrScript2 +function thank_you() { + show_message("thank you!"); + thank_you(); +} + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9b46277 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,309 @@ +{ + "name": "gm-code-exporter", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "gm-code-exporter", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "json5": "^2.2.3", + "yargs": "^17.7.1" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + } + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yargs": { + "version": "17.7.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz", + "integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==", + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..aa18923 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "gm-code-exporter", + "repository": { + "type": "git", + "url": "https://github.com/sohomsahaun/GM-Code-Exporter.git" + }, + "version": "0.0.1", + "description": "A tool to export GameMaker project code as text", + "main": "index.js", + "keywords": ["GameMaker"], + "author": "Sohom Sahaun", + "license": "MIT", + "dependencies": { + "json5": "^2.2.3", + "yargs": "^17.7.1" + } +} diff --git a/src/File.js b/src/File.js new file mode 100644 index 0000000..fc503e4 --- /dev/null +++ b/src/File.js @@ -0,0 +1,32 @@ +const fs = require("fs"); +const JSON5 = require("json5"); +const { trace } = require("./Log"); + +function read_file(path, encoding) { + try { + trace(`Reading file: ${path}`); + return fs.readFileSync(path, encoding); + } catch (err) { + console.error(`Can't read file ${path}.\n${err}`); + } + return ""; +} + +function parse_file(path, encoding) { + try { + return JSON5.parse(read_file(path, encoding)); + } catch (err) { + console.error(`Can't parse file ${path}.\n${err}`); + } + return null; +} + +function write_file(fname, str) { + fs.writeFileSync(fname, str); +} + +module.exports = { + read_file, + parse_file, + write_file +}; \ No newline at end of file diff --git a/src/Log.js b/src/Log.js new file mode 100644 index 0000000..d6180e5 --- /dev/null +++ b/src/Log.js @@ -0,0 +1,21 @@ +function num_format(num) { + let str = ""; + if (num < 10) str += "0"; + str += num.toString(); + return str; +} + +function get_datetime() { + let day = new Date(); + let date = num_format(day.getDate()) + "-" + num_format(day.getMonth()+1) + "-" + num_format(day.getFullYear()); + let time = num_format(day.getHours()) + ":" + num_format(day.getMinutes()) + ":" + num_format(day.getSeconds()); + return (`[${date} ${time}]`); +} + +function trace(string) { + console.log(`${get_datetime()} ${string}`); +} + +module.exports = { + trace +}; \ No newline at end of file diff --git a/src/Types.js b/src/Types.js new file mode 100644 index 0000000..81595f8 --- /dev/null +++ b/src/Types.js @@ -0,0 +1,96 @@ +const fs = require("fs"); +const { read_file } = require("./File"); + +function get_gml_files(path) { + const files = fs.readdirSync(path); + let gml = []; + files.forEach((file) => { + if (file.endsWith(".gml")) { + let fname = file.slice(file.lastIndexOf("/")+1); + fname = fname.slice(0, fname.lastIndexOf(".")); + gml.push(fname); + } + }); + return gml; +} + +class Resource { + constructor(name, path) { + this.name = name; + this.path = path; + this.gmlFiles = get_gml_files(this.path); + } + + get_header(fname) { + return `/// Resource`; + } + + get_footer(fname) { + return ``; + } + + to_text() { + const files = get_gml_files(this.path); + + let out = ``; + + files.forEach((fname) => { + out += this.get_header(fname); + out += `${read_file(`${this.path}/${fname}.gml`)}\n`; + out += this.get_footer(fname); + }); + + return out; + } + + static is(yy) { + return (yy.resourceType !== undefined); + } +} + +class Object extends Resource { + constructor(name, path) { + super(name, path); + } + + get_header(fname) { + return `/// Object : ${this.name} | ${fname}\n`; + } + + get_footer(fname) { + return `\n`; + } + + static is(yy) { + return ( + (yy.resourceType !== undefined) && + (yy.resourceType === "GMObject") + ); + } +} + +class Script extends Resource { + constructor(name, path) { + super(name, path); + } + + get_header(fname) { + return `/// Script : ${this.name}\n`; + } + + get_footer(fname) { + return `\n`; + } + + static is(yy) { + return ( + (yy.resourceType !== undefined) && + (yy.resourceType === "GMScript") + ); + } +} + +module.exports = { + Object, + Script +}; \ No newline at end of file