<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Haroon Rashid</title>
    <description>The latest articles on DEV Community by Haroon Rashid (@haroon_rashid_d09f1c411bd).</description>
    <link>https://dev.to/haroon_rashid_d09f1c411bd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3040892%2F90367a29-5748-4f54-809a-df0262ede7da.jpg</url>
      <title>DEV Community: Haroon Rashid</title>
      <link>https://dev.to/haroon_rashid_d09f1c411bd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/haroon_rashid_d09f1c411bd"/>
    <language>en</language>
    <item>
      <title>How The Sims 4 .ts4script Mods Work (And How to Debug LastException Errors)</title>
      <dc:creator>Haroon Rashid</dc:creator>
      <pubDate>Mon, 30 Nov 2026 07:55:59 +0000</pubDate>
      <link>https://dev.to/haroon_rashid_d09f1c411bd/how-the-sims-4-ts4script-mods-work-and-how-to-debug-lastexception-errors-36ek</link>
      <guid>https://dev.to/haroon_rashid_d09f1c411bd/how-the-sims-4-ts4script-mods-work-and-how-to-debug-lastexception-errors-36ek</guid>
      <description>&lt;p&gt;Unlike many AAA PC games that rely on compiled C++ DLL injections or low-level memory hooks, The Sims 4 runs its core gameplay simulation on an embedded Python 3.7 interpreter paired with XML tuning resources. That architecture makes the game easily accessible to community modders, and it also explains why a routine official patch can break custom scripts. Understanding how the engine loads &lt;code&gt;.package&lt;/code&gt; and &lt;code&gt;.ts4script&lt;/code&gt; archives, how Python monkey-patching interacts with Electronic Arts' simulation loop, and how to read a traceback log makes troubleshooting crashes far faster than blindly wiping your Mods folder.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the Game Engine Loads .package and .ts4script Archives
&lt;/h2&gt;

&lt;p&gt;When The Sims 4 launches, its resource manager reads the Resource.cfg file inside Documents/Electronic Arts/The Sims 4/Mods. By default, that configuration file instructs the engine to scan up to five subfolders deep for .package files, whereas the Python script loader only scans one subfolder deep for .ts4script files. A .package file is a Database Packed File (DBPF) archive that stores binary game assets such as 3D meshes, textures, Create-a-Sim thumbnails, and XML tuning files that govern skill gain multipliers, autonomy weights, object interactions, and UI layout definitions. By contrast, a .ts4script file is simply a standard .zip archive renamed with a custom extension. Inside that archive sits compiled Python 3.7 bytecode (.pyc) alongside occasional readable .py source files. When the game initializes its simulation engine, it mounts those archives and imports their modules directly into Python's sys.modules table.&lt;/p&gt;

&lt;p&gt;Because Python allows runtime monkey-patching—replacing or wrapping existing class methods dynamically in memory—modders can inject custom logic into EA's core simulation classes without touching the base game's simulation.zip or base.zip archives. If you have ever worked with Python decorators or &lt;a href="https://dev.to/t/python"&gt;runtime monkey-patching patterns&lt;/a&gt; in standard backend services, The Sims 4 script mods rely on the exact same mechanism. A mod imports an EA module, stores a reference to the original method, and reassigns that method attribute to a wrapper function that executes custom code before or after calling the original behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Official Patches Trigger LastException Errors
&lt;/h2&gt;

&lt;p&gt;Whenever Electronic Arts pushes a major game update, two structural changes frequently occur inside the base game's Python scripts and tuning files. First, function signatures change as EA's engineers add, rename, or reorder parameters inside core simulation methods such as interaction queue handlers, buff managers, or UI service hooks. Second, new pack mechanics or base-game refactors alter XML tuning instance IDs and schema fields expected by older .package overrides. When an un-updated .ts4script mod attempts to wrap or call a core function whose signature changed in the new build, Python raises an unhandled TypeError, AttributeError, or KeyError. Instead of crashing straight to the desktop immediately, the game's exception handler catches the traceback and serializes an XML log file named lastException.txt directly inside the root The Sims 4 user directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading a lastException.txt Traceback From Bottom to Top
&lt;/h2&gt;

&lt;p&gt;You do not need a Python decompiler to pinpoint a broken mod from a lastException.txt file. Opening the file in any code editor such as VS Code or Notepad++ and reading the stack trace from bottom to top reveals the culprit in under a minute. Start by scrolling to the bottom of the desyncdata block to inspect the final exception line, which states the exact Python error—for instance, an AttributeError indicating a missing sim_info reference or a TypeError reporting a mismatched positional argument. From there, scan upward through the file paths in each stack frame. EA's native game code paths always begin with T:\InGame\Gameplay\Scripts, so any frame listing a custom .ts4script filename, a creator namespace, or a non-EA module path identifies the exact script mod caught in the call stack.&lt;/p&gt;

&lt;p&gt;Paying attention to which subsystem appears in the traceback also helps separate user-interface bugs from deeper simulation errors. If the stack frames reference ui_dialog, scaleform, or cas modules, a user-interface mod is out of sync with the current patch build. Layout mods that alter Create-a-Sim grid columns depend directly on EA's Scaleform and UI scale definitions, so reviewing &lt;a href="https://gamuters.com/gaming/the-sims/more-cas-columns-sims-4/" rel="noopener noreferrer"&gt;More CAS Columns&lt;/a&gt; helps confirm whether a distorted menu comes from an outdated file version or a screen-resolution mismatch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clearing Stale Resource Cache and Isolating Conflicts
&lt;/h2&gt;

&lt;p&gt;Even after you identify and remove an outdated .package or .ts4script file, relaunching the game immediately often leaves the exact same UI glitch or missing icon intact. That happens because The Sims 4 maintains a binary cache file named localthumbcache.package inside the main Documents/Electronic Arts/The Sims 4 directory. This cache stores pre-rendered CAS thumbnails, UI icon sprites, and resource index pointers from previous sessions. Whenever you add, update, or remove a mod, deleting localthumbcache.package forces the game engine to rebuild a clean resource index from scratch on the next launch.&lt;/p&gt;

&lt;p&gt;When multiple mods are installed and no single file stands out in lastException.txt, a disciplined isolation workflow beats starting from zero. First, verify that none of your .ts4script files are nested more than one subfolder deep inside Mods, since Python's module importer skips deeper folders silently without throwing an error. Next, move all .ts4script files and their companion .package files to a temporary desktop folder to test the game with static custom content only. If the game loads cleanly without scripts, the conflict lives inside a Python module rather than a 3D mesh or texture. If the issue persists, split the remaining .package files into two equal halves, delete localthumbcache.package, and test one half at a time in a disposable test save until binary search narrows thousands of files down to the single conflicting archive. Finally, keep in mind that official updates automatically uncheck Enable Custom Content and Mods and Script Mods Allowed inside Game Options under the Other tab, requiring a full restart after you re-enable them.&lt;/p&gt;

&lt;p&gt;If you enjoy exploring how scripting languages power live game engines, browsing &lt;a href="https://dev.to/t/gamedev"&gt;community debugging and game-dev notes&lt;/a&gt; is a great way to see how other studios handle runtime modding and sandbox isolation.&lt;/p&gt;

</description>
      <category>python</category>
      <category>debugging</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Windows Key Not Working on Windows 10/11? Here’s How I Fixed It</title>
      <dc:creator>Haroon Rashid</dc:creator>
      <pubDate>Fri, 09 May 2025 01:51:05 +0000</pubDate>
      <link>https://dev.to/haroon_rashid_d09f1c411bd/windows-key-not-working-on-windows-1011-heres-how-i-fixed-it-5cf2</link>
      <guid>https://dev.to/haroon_rashid_d09f1c411bd/windows-key-not-working-on-windows-1011-heres-how-i-fixed-it-5cf2</guid>
      <description>&lt;p&gt;If you’re a developer working on Windows, you know how central the Windows key is to daily tasks—launching search, snapping windows, opening Run (Win + R), or jumping into PowerShell. When that key stops responding, it’s more than a minor annoyance; it interrupts productivity. You can easily fix &lt;a href="https://sumorb.com/windows/solved-windows-key-not-working-on-windows-10-11/" rel="noopener noreferrer"&gt;Windows Key not Working&lt;/a&gt; on your own.&lt;/p&gt;

&lt;p&gt;I recently faced this exact problem on my Windows 11 system. The Windows key stopped working entirely—no shortcut commands, no start menu access, nothing. After testing a few theories and trying several fixes, I finally solved it.&lt;/p&gt;

&lt;p&gt;Here’s a detailed breakdown of what causes the issue, and more importantly, what actually works to resolve it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Causes of the Issue
&lt;/h2&gt;

&lt;p&gt;Before jumping to fixes, it helps to understand why the Windows key might stop working:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gaming Mode enabled on your keyboard (common with gaming laptops or external keyboards)&lt;/li&gt;
&lt;li&gt;Corrupted system files&lt;/li&gt;
&lt;li&gt;Registry misconfigurations&lt;/li&gt;
&lt;li&gt;Disabled Windows key via Group Policy&lt;/li&gt;
&lt;li&gt;Third-party software conflicts (e.g., AutoHotkey, keyboard remappers)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step-by-Step Fixes That Worked for Me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Check if Gaming Mode is Enabled&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many gaming keyboards have a Gaming Mode toggle that disables the Windows key to prevent accidental presses during gameplay.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check for a "G" icon on your keyboard&lt;/li&gt;
&lt;li&gt;Or open the keyboard software (e.g., Razer Synapse, Logitech G Hub) and toggle Gaming Mode off&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was my issue. I had unknowingly enabled Gaming Mode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Run a System File Check (SFC)&lt;/strong&gt;&lt;br&gt;
Sometimes, Windows system files get corrupted and cause strange behavior.&lt;br&gt;
&lt;code&gt;sfc /scannow&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open Command Prompt as Administrator&lt;/li&gt;
&lt;li&gt;Run the above command and wait for the scan to complete&lt;/li&gt;
&lt;li&gt;Restart your PC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Modify Registry Settings (Safely)&lt;/strong&gt;&lt;br&gt;
If your system registry has been modified (manually or by a tool), the Windows key could be disabled.&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press Win + R, type regedit, hit Enter&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to:&lt;br&gt;
&lt;code&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Look for a value called &lt;strong&gt;Scancode Map&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If it exists, delete it and reboot&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Important: Always back up the registry before editing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Use Group Policy Editor (For Pro/Edu editions)&lt;/strong&gt;&lt;br&gt;
If you’re using Windows 10/11 Pro or Education editions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press Win + R, type gpedit.msc, and hit Enter&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Navigate to:&lt;br&gt;
&lt;code&gt;User Configuration &amp;gt; Administrative Templates &amp;gt; Windows Components &amp;gt; File Explorer&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Double-click on "Turn off Windows Key hotkeys"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set it to "Not Configured" or "Disabled"&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Create a New Local User Account&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If all else fails, your user profile might be corrupted.&lt;/li&gt;
&lt;li&gt;Go to Settings &amp;gt; Accounts &amp;gt; Other users&lt;/li&gt;
&lt;li&gt;Click Add account, and choose "I don’t have this person’s sign-in information"&lt;/li&gt;
&lt;li&gt;Select "Add a user without a Microsoft account"&lt;/li&gt;
&lt;li&gt;Create a local profile and test the Windows key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
This issue had me considering a fresh install at one point, but it turned out to be a simple Gaming Mode toggle. That said, not all causes are obvious, and some require digging into system-level settings.&lt;/p&gt;

&lt;p&gt;If you’ve encountered a similar issue, I’d love to hear how you solved it. Share your experience in the comments, maybe your fix can help someone else in the community.&lt;/p&gt;

</description>
      <category>microsoft</category>
      <category>tutorial</category>
      <category>windows10</category>
      <category>windows11</category>
    </item>
    <item>
      <title>Windows 10</title>
      <dc:creator>Haroon Rashid</dc:creator>
      <pubDate>Thu, 01 May 2025 03:09:16 +0000</pubDate>
      <link>https://dev.to/haroon_rashid_d09f1c411bd/windows-10-ef7</link>
      <guid>https://dev.to/haroon_rashid_d09f1c411bd/windows-10-ef7</guid>
      <description></description>
      <category>microsoft</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
