{"id":16,"date":"2018-05-09T17:20:02","date_gmt":"2018-05-09T17:20:02","guid":{"rendered":"https:\/\/blogs.scummvm.org\/pantherengine\/?p=16"},"modified":"2022-05-23T17:21:32","modified_gmt":"2022-05-23T17:21:32","slug":"reverse-engineering-pink-classes","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/pantherengine\/2018\/05\/09\/reverse-engineering-pink-classes\/","title":{"rendered":"Reverse Engineering Pink Classes"},"content":{"rendered":"<p>This post will be about the reversing serialized objects, located in ORB file.<span id=\"more-15\"><\/span>They are written in ORB using MFC library.<\/p>\n<p>Firstly, I parsed class names. To do that, I have written simple\u00a0<a href=\"https:\/\/gist.github.com\/whiterandrek\/ed13999fac6a79d91c5f87544bb59c4a\" target=\"_blank\" rel=\"noopener\">program<\/a>\u00a0in C++.\u00a0 Each class in Pink starts with letter \u2018C\u2019, so program just finds this letter, then reads name as MFC String and checks it for correctness.<\/p>\n<p>I\u2019ve got 48 for\u00a0<a href=\"https:\/\/gist.github.com\/whiterandrek\/58c1dc0a314be2bd8505987160214717\">Peril\u00a0<\/a>and 45 for\u00a0<a href=\"https:\/\/gist.github.com\/whiterandrek\/1f194f1f26d3a5a189afafc2cc2a6297\">Pokus<\/a>.<\/p>\n<p>Secondly, I found out fields names. It was really easy.<\/p>\n<p>When these games were created, developers had program creating the game files. This program wrote data to txt files, but not using MFC serialization, because the game engine has code for executing game from txt files. That\u2019s why each class has virtual method, which writes attribute name and value. For example, CConditionVariable class:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.scummvm.org\/pantherengine\/wp-content\/uploads\/sites\/31\/2022\/05\/cond.png\" \/><\/p>\n<p>Each class in Pink games can be reversed using this approach.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post will be about the reversing serialized objects, located in ORB file.They are written in ORB using MFC library. Firstly, I parsed class names. To do that, I have written simple\u00a0program\u00a0in C++.\u00a0 Each class in Pink starts with letter \u2018C\u2019, so program just finds this letter, then reads name as MFC String and checks [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-16","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/posts\/16","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/comments?post=16"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/posts\/16\/revisions"}],"predecessor-version":[{"id":20,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/posts\/16\/revisions\/20"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/media?parent=16"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/categories?post=16"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/pantherengine\/wp-json\/wp\/v2\/tags?post=16"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}