@@ -35,6 +35,9 @@ methodmap MemoryPatch < Handle {
3535 /* *
3636 * Returns the starting address of the patch, equivalent to the address of the patch's
3737 * dependent signature plus the patch offset.
38+ *
39+ * @error Plugin is running on a 64-bit server; SourceMod does not support full usage of
40+ * 64-bit addresses at this time.
3841 */
3942 property Address Address {
4043 public native get ();
@@ -59,6 +62,9 @@ methodmap MemoryBlock < Handle {
5962
6063 /* *
6164 * Returns the address of the allocated memory block.
65+ *
66+ * @error Plugin is running on a 64-bit server; SourceMod does not support full usage of
67+ * 64-bit addresses at this time.
6268 */
6369 property Address Address {
6470 public native get ();
@@ -75,44 +81,28 @@ methodmap MemoryBlock < Handle {
7581 * Load up to 4 bytes from an offset to the memory block, performing bounds checks to ensure
7682 * reads are contained within the block.
7783 */
78- public int LoadFromOffset (int offset , NumberType size ) {
79- if (offset < 0 || offset + GetNumberTypeByteSize (size ) > this .Size ) {
80- ThrowError (" Cannot perform MemoryBlock access of %d bytes at offset %d (limit %d )" ,
81- GetNumberTypeByteSize (size ), offset , this .Size );
82- }
83- return LoadFromAddress (this .Address + view_as <Address >(offset ), size );
84- }
84+ public native int LoadFromOffset (int offset , NumberType size );
8585
8686 /* *
8787 * Store up to 4 bytes to an offset to the memory block, performing bounds checks to ensure
8888 * writes are contained within the block.
8989 */
90- public void StoreToOffset (int offset , int data , NumberType size ) {
91- if (offset < 0 || offset + GetNumberTypeByteSize (size ) > this .Size ) {
92- ThrowError (" Cannot perform MemoryBlock access of %d bytes at offset %d (limit %d )" ,
93- GetNumberTypeByteSize (size ), offset , this .Size );
94- }
95- StoreToAddress (this .Address + view_as <Address >(offset ), data , size );
96- }
90+ public native void StoreToOffset (int offset , int data , NumberType size );
9791};
9892
99- static stock int GetNumberTypeByteSize (NumberType size ) {
100- switch (size ) {
101- case NumberType_Int8 : return 1 ;
102- case NumberType_Int16 : return 2 ;
103- case NumberType_Int32 : return 4 ;
104- }
105- ThrowError (" Unknown NumberType %d . Did the SourceMod developers add some new ones?" , size );
106- return 1 ; // maybe `return (1 << size);` ?
107- }
108-
10993/* *
11094 * Returns the physical memory address of a given SourcePawn cell reference.
95+ *
96+ * @error Plugin is running on a 64-bit server; SourceMod does not support full usage of
97+ * 64-bit addresses at this time.
11198 */
11299native Address GetAddressOfCell (any & cell );
113100
114101/* *
115102 * Returns the physical memory address of a given string.
103+ *
104+ * @error Plugin is running on a 64-bit server; SourceMod does not support full usage of
105+ * 64-bit addresses at this time.
116106 */
117107native Address GetAddressOfString (char [] array );
118108
0 commit comments