From 50e86d6ed5bc0089bd4aaa91665165f38a248850 Mon Sep 17 00:00:00 2001 From: Matti Date: Thu, 12 Dec 2024 00:01:55 +0100 Subject: [PATCH] Access Status VERY Illegally --- Aufg9/DiabloByteReader.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Aufg9/DiabloByteReader.cpp b/Aufg9/DiabloByteReader.cpp index ff11c4e..6923828 100644 --- a/Aufg9/DiabloByteReader.cpp +++ b/Aufg9/DiabloByteReader.cpp @@ -33,10 +33,21 @@ void Aufg9Main() { char *fuckery = (char *)test; printf("Fuckery: %X\n", fuckery); - char *bit20 = &dest[20]; + // Name + char *byte20 = &dest[20]; + std::cout << "Name: "; for (int i = 0; i < 16; i++) { - std::cout << bit20[i]; + std::cout << byte20[i]; } + std::cout << std::endl; + + char* byte36 = &dest[36]; + std::cout << "Status: " << (((int)(*((bool *)byte36)))%8)/4 << std::endl; // geh zu Byte 36, lies genau 1 byte (da sizeOf(bool) = 1), interpretier es als int, berechner mod 8 -> wegwerfen der linken Bits, /4 -> wegwerfen der rechten beiden Bits -> Tada, nur das 3. Bit von Rechts bleibt übrig + + // Klasse + bool *byte40 = (bool*) &dest[40]; + std::cout << "Klasse: " << byte40[0] << std::endl; + // 2 -> Necromancer } catch (const std::exception &e) {