From 2afb5eba897f8301f0949f071b9ed2dad837efe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20W=C3=B3jcik?= Date: Thu, 16 Feb 2023 21:15:00 +0100 Subject: [PATCH] [SniffEmu] v1.0.0 --- SniffEmu/.editorconfig | 12 ++ SniffEmu/.gitignore | 4 + SniffEmu/LICENSE | 19 ++++ SniffEmu/README.md | 65 +++++++++++ SniffEmu/SniffEmu.info | Bin 0 -> 1484 bytes SniffEmu/SniffEmu/Readme | 44 ++++++++ SniffEmu/SniffEmu/Readme.info | Bin 0 -> 1312 bytes SniffEmu/SniffEmu/SniffEmu | Bin 0 -> 9036 bytes SniffEmu/SniffEmu/Source.info | Bin 0 -> 1484 bytes SniffEmu/SniffEmu/Source/Makefile | 18 +++ SniffEmu/SniffEmu/Source/SniffEmu.c | 164 ++++++++++++++++++++++++++++ SniffEmu/SniffEmu/Source/SniffEmu.h | 17 +++ SniffEmu/dist/SniffEmu.readme | 52 +++++++++ 13 files changed, 395 insertions(+) create mode 100755 SniffEmu/.editorconfig create mode 100755 SniffEmu/.gitignore create mode 100644 SniffEmu/LICENSE create mode 100644 SniffEmu/README.md create mode 100644 SniffEmu/SniffEmu.info create mode 100755 SniffEmu/SniffEmu/Readme create mode 100644 SniffEmu/SniffEmu/Readme.info create mode 100755 SniffEmu/SniffEmu/SniffEmu create mode 100644 SniffEmu/SniffEmu/Source.info create mode 100755 SniffEmu/SniffEmu/Source/Makefile create mode 100755 SniffEmu/SniffEmu/Source/SniffEmu.c create mode 100755 SniffEmu/SniffEmu/Source/SniffEmu.h create mode 100644 SniffEmu/dist/SniffEmu.readme diff --git a/SniffEmu/.editorconfig b/SniffEmu/.editorconfig new file mode 100755 index 0000000..42ece7c --- /dev/null +++ b/SniffEmu/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf + +[{Makefile}] +indent_style = tab +tab_size = 4 + +[{*.c,*.h}] +indent_style = space +tab_size = 4 diff --git a/SniffEmu/.gitignore b/SniffEmu/.gitignore new file mode 100755 index 0000000..8eccdb4 --- /dev/null +++ b/SniffEmu/.gitignore @@ -0,0 +1,4 @@ +_UAEFSDB.___ +dist/*.lha +SniffEmu/Source/*.asm +SniffEmu/Source/*.o diff --git a/SniffEmu/LICENSE b/SniffEmu/LICENSE new file mode 100644 index 0000000..3fa3d9a --- /dev/null +++ b/SniffEmu/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2023-present BTHLabs (https://bthlabs.pl) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/SniffEmu/README.md b/SniffEmu/README.md new file mode 100644 index 0000000..636a0af --- /dev/null +++ b/SniffEmu/README.md @@ -0,0 +1,65 @@ +# SniffEmu + +CLI tool to "detect" if the system is running in emulator + +## Description + +SniffEmu is a small CLI tool to "detect" if the system is running in +emulation-like environment, e.g. UAE. I use it to conditionally execute parts +of Startup-Sequence, e.g. to can skip FBlit when the OS is booting on PiStorm. + +Usage: SniffEmu HELP/S RTG/S MODE + +`MODE` is one of `EMU68`, `UAE` or `MUSASHI`. `RTG/S` allows you to +specifically look for the emulator's RTG card, so you can e.g. set up the +proper screen mode. + +Example: + +``` +> SniffEmu EMU68 +SniffEmu: Looking for board: 28019:-1... NOT FOUND +``` + +``` +> SniffEmu RTG UAE +SniffEmu: Looking for board: 2011:96... FOUND +``` + +If the emulator (or RTG) was detected, the program will set the returncode to +`WARN`. Otherwise, it'll be `OK`. + +Example script: + +``` +C:SniffEmu RTG UAE >NIL: +If WARN + Echo "Found UAE RTG!" +EndIf +``` + +Note: MUSASHI support is currently untested. If anybody uses it, let me know +about the results ;). + +## Requirements + +AmigaOS 3.1+, MC68020+ + +## Changelog + +Version 1.0.0 (16.02.2023) + + * Initial release. + +## Contributing + +If you think you found a bug or want to send a patch, feel free to contact +me through e-mail. + +## Author + +ScreenSaver is developed by [Tomek WĆ³jcik](https://www.bthlabs.pl/). + +## License + +ScreenSaver is licensed under the MIT License. diff --git a/SniffEmu/SniffEmu.info b/SniffEmu/SniffEmu.info new file mode 100644 index 0000000000000000000000000000000000000000..f9e96d49c9658c6733096cb050f54e138a82c83e GIT binary patch literal 1484 zcmZ8gTWr%-82+7hp%+3Ob1CqEn^1J+Mc^Dkm?adO9XYg=Y-`?1B%=W7jiI1%SuvKLGH; zntdJKw>-N$I`M&d+crFJ-FIO3Ud(I;O9eqxnkvCDP(|YJGuUo-eQCD4-EB9`?d<^? zh}DXXZEW=W4>_HThdDT3ceB=yQ@?+~w=P6N+f}pQ>2yuiIGI3zNi@_`jZU4;AU&Xj z7JzP2ZBva-y_ilMEX)1{*N~#CRv9XmO}w#|dQRr!0)Zn>;pTGC*#K6=XLCFBMi@VH zh-DGs!VAQ9zwV8BOk}EtWw`)H^J+sBF&AsWES6(A8QwF})|JyZWF>gg;qiESdN?jI zZH~p_kuP9~uXfdm=6J%f*lin;$98TQx@Z#Ve$6{w5eq*h zw`3OiSHGdts`spxC|WX-C}!f=@Ro0j;NVJpmBI_hQbJ1ZZ@ovSA<|ow5i;V??OIW~ z|KR>W5v-Q^ft5a!2AZ0%hK6oLa$kEBqk;HHTO{WS4XOLp4eC|(k*cXs-aFT!&e%IC z*sAXxOMWByd~N#UAx&zV{P_Jf()6f_qJ0|aZw`c}%>kB;OjSptVuwwxo3F5Yl!FwK{tZdPnuE41cSk3 zQV?>tv~)AVo2eZL>S6(xEQq3r4r3bmT?>+f!O$&h5JB`fZ!6W!*V{XTdb)t=qSB9V z?u?rrtD|<5^OHx>K>XB(|9z^3iDK3<0sGYTl62k%V70&bpMGEw-@J6jjcmK#S1{B| zXRxG<g($p9+srh+vY-HBsaeDnvEo=9hYCy^0Nlv@UK_i zxnwv*xd79p_)=ZbcvMa-)jre9=|L$g6_kASQvUXNUEESi*DR&8S>5k=?KNzaYLU~( zDP(gakQ+xxk629CDCxm$VWhB-pD?^4N2>}FlI}n*TPBrGZ SniffEmu EMU68 +SniffEmu: Looking for board: 28019:-1... NOT FOUND + +> SniffEmu RTG UAE +SniffEmu: Looking for board: 2011:96... FOUND + +If the emulator (or RTG) was detected, the program will set the returncode to +WARN. Otherwise, it'll be OK. + +Example script: + +C:SniffEmu RTG UAE >NIL: +If WARN + Echo "Found UAE RTG!" +EndIf + +Note: MUSASHI support is currently untested. If anybody uses it, let me know +about the results ;). + +Requirements: AmigaOS 3.1+, MC68020+ + +SniffEmu is developed by Tomek Wójcik + +SniffEmu is licensed under the MIT License. + +Changelog +--------- + +Version 1.0.0 (16.02.2023) + + * Initial release. diff --git a/SniffEmu/SniffEmu/Readme.info b/SniffEmu/SniffEmu/Readme.info new file mode 100644 index 0000000000000000000000000000000000000000..96c682b5ff1d19cacb93477bbd31472649e5125d GIT binary patch literal 1312 zcmY*WU2GIp7`=CQ*q{F1xv55s>Fn(Eg$J@_nMhU})7rVzCbT=HvzQvgih*4>X=F|7 z?wfTRLzD+;OrzNi0W=u1ynvuJU=%3&tTBx~8I^`eOr@PdTMFxp-@P-{@J%xJ&OPTl z=X`S)3Bm{prx8IBcqI77r1m9 zhVvfumjCp4W|Ts0w^3-d_;ab8&*yT$R-Ok6AhHSwwqw_!QO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EAjnXSJ(eDn~8MIk>stqP01O+8sU~Tx(=dH)0Gh;% zxTuX4P4l;=r{_oW#oRn}iKsVMa+ON%HNU-O)-+8QCrj$;v1A literal 0 HcmV?d00001 diff --git a/SniffEmu/SniffEmu/Source/Makefile b/SniffEmu/SniffEmu/Source/Makefile new file mode 100755 index 0000000..44a1f64 --- /dev/null +++ b/SniffEmu/SniffEmu/Source/Makefile @@ -0,0 +1,18 @@ +DEVPACK := DEVPACK: +VBCC := $(DEVPACK)VBCC + +CC := $(VBCC)/bin/vc + +OUTFILE := /SniffEmu + +OBJECTS := SniffEmu.o +CFLAGS := -I$(DEVPACK)ADE/os-include +LIBS := -lamiga + +all: $(OUTFILE) + +clean: + Delete ALL FORCE $(OUTFILE) $(OBJECTS) + +$(OUTFILE): $(OBJECTS) + $(CC) $(LIBS) -o $(OUTFILE) $(OBJECTS) diff --git a/SniffEmu/SniffEmu/Source/SniffEmu.c b/SniffEmu/SniffEmu/Source/SniffEmu.c new file mode 100755 index 0000000..bb449f9 --- /dev/null +++ b/SniffEmu/SniffEmu/Source/SniffEmu.c @@ -0,0 +1,164 @@ +/* + * SniffEmu by BTHLabs + * Copyright (c) 2023-present BTHLabs (https://bthlabs.pl) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include +#include +#include +#include +#include + +#include "SniffEmu.h" + +struct ExpansionBase * ExpansionBase; + +static STRPTR verstring = APP_VSTRING; + +static char *MODE_NAME_EMU68 = "EMU68"; +static char *MODE_NAME_UAE = "UAE"; +static char *MODE_NAME_MUSASHI = "MUSASHI"; + +#define TEMPLATE "HELP/S,RTG/S,MODE" + +typedef enum { + OPT_HELP, + OPT_RTG, + OPT_MODE, + OPT_COUNT +} OPT_ARGS; + +typedef enum { + MODE_UNKNOWN, + MODE_EMU68, + MODE_UAE, + MODE_MUSASHI +} MODE; + +int help() { + printf( + "SniffEmu %s by BTHLabs\n" + "Developed by Tomek Wójcik\n" + "bthlabs.pl | MIT License\n", + VERSION + ); + + printf( + "\n" + "Usage: SniffEmu HELP/S RTG/S MODE\n" + "\n" + "HELP : Print this help\n" + "RTG : Sniff the RTG board\n" + "MODE : Specify the emulator to sniff\n" + " Valid values: EMU68, UAE, MUSASHI\n" + ); + + return RETURN_OK; +} + +int find_board(int manufacturer, int product) { + int result = RETURN_OK; + + printf("SniffEmu: Looking for board: %d:%d... ", manufacturer, product); + + if (ExpansionBase = (struct ExpansionBase *)OpenLibrary(EXPANSIONNAME, 0L)) { + struct ConfigDev* cd = NULL; + + while (cd = FindConfigDev(cd, manufacturer, product)) { + result = RETURN_WARN; + } + } + + if (result == RETURN_WARN) { + printf("FOUND\n"); + } else { + printf("NOT FOUND\n"); + } + + return result; +} + +int main(int argc, char *argv[]) { + int result = RETURN_OK; + int opts[OPT_COUNT]; + struct RDArgs *rdargs; + int manufacturer = -1; + int product = -1; + + if (argc > 1) { + memset((char *)opts, 0, sizeof(opts)); + + if (rdargs = (struct RDArgs *)ReadArgs(TEMPLATE, opts, NULL)) { + if (opts[OPT_HELP]) { + result = help(); + } else { + MODE mode = MODE_UNKNOWN; + + if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_EMU68) == 0) { + mode = MODE_EMU68; + } else if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_UAE) == 0) { + mode = MODE_UAE; + } else if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_MUSASHI) == 0) { + /* MUSASHI mode is untested. */ + mode = MODE_MUSASHI; + } else { + printf("SniffEmu: Invalid MODE: `%s`\n", opts[OPT_MODE]); + result = help(); + } + + if (mode != MODE_UNKNOWN) { + if (mode == MODE_EMU68) { + manufacturer = EMU68_MANUFACTURER; + } else if (mode == MODE_UAE) { + manufacturer = UAE_MANUFACTURER; + } else if (mode == MODE_MUSASHI) { + manufacturer = MUSASHI_MANUFACTURER; + product = MUSASHI_INTERACTION; + } + + if (opts[OPT_RTG]) { + if (mode == MODE_EMU68) { + product = EMU68_RTG; + } else if (mode == MODE_UAE) { + product = UAE_RTG; + } else if (mode == MODE_MUSASHI) { + printf("SniffEmu: Can't reliably sniff RTG on Musashi :(\n"); + product = MUSASHI_RTG; + } + } + + result = find_board(manufacturer, product); + } + } + + FreeArgs(rdargs); + } else { + printf("SniffEmu: Invalid arguments.\n"); + result = help(); + } + } else { + result = help(); + } + + return result; +} diff --git a/SniffEmu/SniffEmu/Source/SniffEmu.h b/SniffEmu/SniffEmu/Source/SniffEmu.h new file mode 100755 index 0000000..9015fc8 --- /dev/null +++ b/SniffEmu/SniffEmu/Source/SniffEmu.h @@ -0,0 +1,17 @@ +#ifndef __SNIFFEMU_H__ +#define __SNIFFEMU_H__ + +#define VERSION "1.0.0" +#define DATE "16.02.2023" + +#define APP_VSTRING "$VER: SniffEmu " VERSION " (" DATE ")" + +#define EMU68_MANUFACTURER (0x6d73) +#define EMU68_RTG (0x24) +#define UAE_MANUFACTURER (0x7db) +#define UAE_RTG (0x60) +#define MUSASHI_MANUFACTURER (0x7db) +#define MUSASHI_INTERACTION (0x6b) +#define MUSASHI_RTG (0x6b) + +#endif diff --git a/SniffEmu/dist/SniffEmu.readme b/SniffEmu/dist/SniffEmu.readme new file mode 100644 index 0000000..08d6b71 --- /dev/null +++ b/SniffEmu/dist/SniffEmu.readme @@ -0,0 +1,52 @@ +Short: CLI tool to "detect" if the system is running in emulator +Author: Tomek Wójcik +Uploader: Tomek Wójcik +Type: util/sys +Version: 1.0.0 +Architecture: m68k-amigaos +Requires: AmigaOS 3.1+, MC68020+ + +SniffEmu by BTHLabs + +SniffEmu is a small CLI tool to "detect" if the system is running in +emulation-like environment, e.g. UAE. I use it to conditionally execute parts +of Startup-Sequence, e.g. to can skip FBlit when the OS is booting on PiStorm. + +Usage: SniffEmu HELP/S RTG/S MODE + +MODE is one of EMU68, UAE or MUSASHI. RTG/S allows you to specifically look +for the emulator's RTG card, so you can e.g. set up the proper screen mode. + +Example: + +> SniffEmu EMU68 +SniffEmu: Looking for board: 28019:-1... NOT FOUND + +> SniffEmu RTG UAE +SniffEmu: Looking for board: 2011:96... FOUND + +If the emulator (or RTG) was detected, the program will set the returncode to +WARN. Otherwise, it'll be OK. + +Example script: + +C:SniffEmu RTG UAE >NIL: +If WARN + Echo "Found UAE RTG!" +EndIf + +Note: MUSASHI support is currently untested. If anybody uses it, let me know +about the results ;). + +Requirements: AmigaOS 3.1+, MC68020+ + +SniffEmu is developed by Tomek Wójcik + +SniffEmu is licensed under the MIT License. + +Changelog +--------- + +Version 1.0.0 (16.02.2023) + + * Initial release.